ActiveState Powered by ActiveState

ActiveState Community


Why is there no Chinese encoding options in the program?

Posted by steven on 2007-08-05 06:15
OS: All / Any

Hi,

I'm wondering if you could add more char encoding options like Chinese

Steven

shanec | Mon, 2007-08-06 14:23

Here is code to add Chinese and Japanese character encodings. Find the file koEncodingServices.py in the Komodo installation, and add the following at line 102.

koEncodingHierarchyCategory(
                    'Asia',
                    [
                    ('gb18030', "Simplified Chinese (GB18030)", 'GB18030', '', 1,'gb18030'),
                    ('gb2312', "Simplified Chinese (GB2312-1980)", 'GB2312-1980', '', 1,'gb2312'),
                    ('hz', 'Simplified Chinese (Hz)', 'Hz', '', 1,'hz'),
                    ('big5', 'Traditional Chinese (Big5)', 'Big5', '', 1,'big5'),
                    ('cp950', 'Traditional Chinese (Microsoft CP-950)', 'CP950', '', 1,'cp950'),
                    ('big5hkscs', 'Traditional Chinese (HKSCS)', 'HKSCS', '', 1,'big5hkscs'),
                    ('shift_jis', 'Shift JIS', 'Shift JIS', '', 1,'shift_jis'),
                    ('shift_jis_2004', 'Shift JIS 2004', 'Shift JIS 2004', '', 1,'shift_jis_2004'),
                    ('shift_jisx0213', 'Shift JIS X 0208', 'Shift JIS X 0208', '', 1,'shift_jisx0213'),
                    ('cp932', 'Shift JIS (CP-932)', 'CP932', '', 1,'cp932'),
                    ('gbk', 'GBK (CP-936/GBK)', 'CP936/GBK', '', 1,'gbk'),
                    ]
                ),
koEncodingHierarchyCategory(
                    'Asia',
                    [
                    ('gb18030', "Simplified Chinese (GB18030)", 'GB18030', '', 1,'gb18030'),
                    ('gb2312', "Simplified Chinese (GB2312-1980)", 'GB2312-1980', '', 1,'gb2312'),
                    ('hz', 'Simplified Chinese (Hz)', 'Hz', '', 1,'hz'),
                    ('big5', 'Traditional Chinese (Big5)', 'Big5', '', 1,'big5'),
                    ('cp950', 'Traditional Chinese (Microsoft CP-950)', 'CP950', '', 1,'cp950'),
                    ('big5hkscs', 'Traditional Chinese (HKSCS)', 'HKSCS', '', 1,'big5hkscs'),
                    ('shift_jis', 'Shift JIS', 'Shift JIS', '', 1,'shift_jis'),
                    ('shift_jis_2004', 'Shift JIS 2004', 'Shift JIS 2004', '', 1,'shift_jis_2004'),
                    ('shift_jisx0213', 'Shift JIS X 0208', 'Shift JIS X 0208', '', 1,'shift_jisx0213'),
                    ('cp932', 'Shift JIS (CP-932)', 'CP932', '', 1,'cp932'),
                    ('gbk', 'GBK (CP-936/GBK)', 'CP936/GBK', '', 1,'gbk'),
                    ]
                ),

shanec | Mon, 2007-08-06 14:24

I haven't tested that stuff, if you can, would you post your results? (ie. if it works or not for you). We never added these encodings because we have no reliable way of testing them.

steven | Thu, 2007-08-09 17:47

Hi shanec,

Thank you, it's working.

Just that it seems Komodo remembers which encoding I used last time when I opened a certain file. I had to close the app, remove "doc-state.xmlc" located in %appdata%\ActiveState\KomodoIDE\4.2 (Windows), and then open the app to make it work for recently opened files. Not a big deal tho.

Steven

shanec | Fri, 2007-08-10 12:48

I've added this in Change 281134

-->