IronLanguages / main

Work for this repo has moved to https://github.com/IronLanguages/ironpython2
1.16k stars 348 forks source link

can't distinguish unicode char name #595

Closed ironpythonbot closed 8 years ago

ironpythonbot commented 9 years ago

u"\N{LATIN CAPITAL LETTER T}"
u"\N{LATIN SMALL LETTER T}"
u"\N{LATIN CAPITAL LETTER D}"
u"\N{LATIN SMALL LETTER D}"
u"\N{HANGUL SYLLABLE JJYOSS}"
u"\N{CJK UNIFIED IDEOGRAPH-20000}"
u"\N{HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK}"
u"\N{SPACE}"
u"\N{FULL STOP}"

E:\2.5test\ironpythonCompatableFor2.5\25\Lib>ipy
IronPython console: IronPython 2.0A6 (2.0.11102.00) on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.

u";\N{LATIN CAPITAL LETTER T}";
'\N{LATIN CAPITAL LETTER T}'
u";\N{LATIN SMALL LETTER T}";
'\N{LATIN SMALL LETTER T}'
u";\N{LATIN CAPITAL LETTER D}";
'\N{LATIN CAPITAL LETTER D}'
u";\N{LATIN SMALL LETTER D}";
'\N{LATIN SMALL LETTER D}'
u";\N{HANGUL SYLLABLE JJYOSS}";
'\N{HANGUL SYLLABLE JJYOSS}'
u";\N{CJK UNIFIED IDEOGRAPH-20000}";
'\N{CJK UNIFIED IDEOGRAPH-20000}'
u";\N{HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK}";
'\N{HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK}'
u";\N{SPACE}";
'\N{SPACE}'
u";\N{FULL STOP}";
'\N{FULL STOP}'

E:\2.5test\ironpythonCompatableFor2.5\25\Lib>python
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win
32
Type ";help";, ";copyright";, ";credits"; or ";license"; for more information.
u";\N{LATIN CAPITAL LETTER T}";
u'T'
u";\N{LATIN SMALL LETTER T}";
u't'
u";\N{LATIN CAPITAL LETTER D}";
u'D'
u";\N{LATIN SMALL LETTER D}";
u'd'
u";\N{HANGUL SYLLABLE JJYOSS}";
u'\ucb40'
u";\N{CJK UNIFIED IDEOGRAPH-20000}";
u'\U00020000'
u";\N{HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK}";
u'\uff9f'
u";\N{SPACE}";
u' '
u";\N{FULL STOP}";
u'.'

Work Item Details

Original CodePlex Issue: Issue 23843 Status: Active Reason Closed: Unassigned Assigned to: Unassigned Reported on: Jul 28, 2009 at 12:00 AM Reported by: dfugate Updated on: Feb 22, 2013 at 2:12 AM Updated by: jdhardy Custom value: Reported internally at Microsoft. Test: test_ucn.py CreatedDate: 11/25/2007 NewInternalID: 409656 OldInternalID: 323261 AreaPath: IronPython\Runtime

slozier commented 8 years ago

This one still doesn't work.

markusschaber commented 8 years ago

The code seems to be there in the parser, in LiteralParser.cs, with a conditional compilation on #if FEATURE_COMPRESSION. The feature seems to be defined on the builds for .NET 2, .NET 4, .NET 4.5 and Android, but not on other build targets.

markusschaber commented 8 years ago

When trying it, I get null reference exceptions, so it behaves differently than originally. After issuing an import unicodedata, it works fine. So I guess the literal parser ought to make sure the unicode module is loaded in the right moment.

markusschaber commented 8 years ago

A single line fix in literalparser.cs, line 118:

 #if FEATURE_COMPRESSION
                             case 'N': {
+                                    IronPython.Modules.unicodedata.PerformModuleReload(null, null);
                                     if (i < l && text[i] == '{') {
                                         i++;