sgzwiz / brython

Automatically exported from code.google.com/p/brython
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Only ascii characters are recognized #53

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Define a function with accented characters.
2. Attempt to translate it in the Brython console

What is the expected output? What do you see instead?
I would expect this to work, as Python 3 support utf-8 and so does javascript.  
Instead, the following is raised (in the specific example
I tried):
Uncaught SyntaxError: unknown token [é]
module '__main__' line 1
def testé: 

What version of the product are you using? On what operating system?
The brython console http://brython.info/tests/console_en.html as of the date of 
this report.

Please provide any additional information below.

Original issue reported on code.google.com by andre.ro...@gmail.com on 24 Jan 2013 at 3:35

GoogleCodeExporter commented 9 years ago
Since it appears that identifiers are recognized via a regular expression,
a solution (according to 
http://stackoverflow.com/questions/6381752/validating-users-utf-8-name-in-javasc
ript) might be to use the file xregexp.js, xregexp-unicode-base.js from 
http://xregexp.com/plugins/

Original comment by andre.ro...@gmail.com on 24 Jan 2013 at 3:41

GoogleCodeExporter commented 9 years ago
A ready-made alternative, which does not require an external library but would 
require some slight adjustement to exclude Python keywords, might be provided 
by the top answer to this question: 
http://stackoverflow.com/questions/1661197/valid-characters-for-javascript-varia
ble-names

Original comment by andre.ro...@gmail.com on 24 Jan 2013 at 3:47