Filenames with non-ASCII characters are not represented well in exception messages
System information
What is your operating system and version? Flatpak runtime
What is your version of GJS? 1.57.1
Bug information
Steps to reproduce
(╯°□°)╯︵ ┻━┻.js:
throw new Error('(╯°□°)╯︵ ┻━┻');
Current behaviour
The name of this file is not represented well in the stack trace that is printed when executing it.
$ gjs \(╯°□°\)╯︵\ ┻━┻.js
(gjs:37): Gjs-WARNING **: 14:00:31.796: JS ERROR: Error: (╯°□°)╯︵ ┻━┻
@(â\u0095¯Â°â\u0096¡Â°)â\u0095¯ï¸µ â\u0094»â\u0094\u0081â\u0094».js:1:7
Script (╯°□°)╯︵ ┻━┻.js threw an exception
It seems the SpiderMonkey demo interpreter also gets this wrong, but in a different way, so I assume the problem can be solved on our end. We need to somehow indicate when setting the name of the file to be executed which encoding it is in.
$ js60 \(╯°□°\)╯︵\ ┻━┻.js
(╯°□°)╯︵ ┻━┻.js:1:7 Error: (╯°□°)╯︵ ┻━┻
Stack:
@(â¯Â°â¡Â°)â¯ï¸µ â»ââ».js:1:7
Expected behaviour
The exception message should be something more like this:
$ gjs \(╯°□°\)╯︵\ ┻━┻.js
(gjs:37): Gjs-WARNING **: 14:00:31.796: JS ERROR: Error: (╯°□°)╯︵ ┻━┻
@(╯°□°)╯︵ ┻━┻.js:1:7
Script (╯°□°)╯︵ ┻━┻.js threw an exception