jadbox / brackets-integrated-development

IDE-like support for Brackets
49 stars 7 forks source link

Results window does not suport UTF-8? #30

Open LudovicRousseau opened 6 years ago

LudovicRousseau commented 6 years ago

I use Python3 as configured in https://github.com/jadbox/brackets-integrated-development/issues/1#issuecomment-172174051

My program is:

#! /usr/bin/env python3

import sys
print(sys.version)

# comment with accent: voici voilà

print("voici voilà")

On the macOS Terminal console the output is:

$ python3 utf8.py 
3.6.3 (default, Oct  4 2017, 06:09:15) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)]
voici voilà

In Brackets "Run Results" window I get the error:

, in
     print("voici voil\xe0")
UnicodeEncoreError: 'ascii' codec can't encode character '\xe0' in position 10: ordinal not in range(128)

Note that \xe0 is the ISO-8859-1 encoding for "à". The UTF-8 encoding is \xc3\xa0. My source code file is encoded using UTF-8.

I have no idea what/who is converting from UTF-8 to ISO-8859-1.

LudovicRousseau commented 6 years ago

The problem may be related to https://github.com/jadbox/brackets-integrated-development/issues/20

LudovicRousseau commented 6 years ago

If I start Brackets from the Terminal application using open /Applications/Brackets.app I do not have the problem. The difference is that when started from Terminal the environment variable LANG is set to fr_FR.UTF-8.

One solution to my problem is to created a wrapper application:

$ find /Applications/Brackets-unicode.app
/Applications/Brackets-unicode.app
/Applications/Brackets-unicode.app/Contents
/Applications/Brackets-unicode.app/Contents/MacOS
/Applications/Brackets-unicode.app/Contents/MacOS/brackets.sh
/Applications/Brackets-unicode.app/Contents/Resources
/Applications/Brackets-unicode.app/Contents/Resources/appshell.icns
/Applications/Brackets-unicode.app/Contents/Info.plist

The script brackets.sh contains:

#!/bin/bash

export LANG=fr_FR.UTF-8
open - a Brackets.app

Maybe the same kind of trick could be used in Brackets. This bugs should be for Brackets and not for the plugin.

LudovicRousseau commented 6 years ago

I opened a bug at Brackets https://github.com/adobe/brackets/issues/14002