kostyll / python-spidermonkey

Automatically exported from code.google.com/p/python-spidermonkey
GNU General Public License v2.0
0 stars 0 forks source link

Seems does not support UNICODE scripts #13

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Simply pass an unicode string containing non-ascii chars to 
cx.eval_script() . The following exception raised.

  File "spidermonkey.pyx", line 640, in spidermonkey.Context.eval_script
UnicodeEncodeError: 'ascii' codec can't encode characters in position 
24-30: ordinal not in range(128)

What is the expected output? What do you see instead?
N/A

What version of the product are you using? On what operating system?
Latest version got by SVN.

Please provide any additional information below.

Original issue reported on code.google.com by SemigodK...@gmail.com on 13 Apr 2010 at 9:06

GoogleCodeExporter commented 9 years ago
It looks like a newer version on Github has added support for Unicode: 
https://github.com/davisp/python-spidermonkey

I'll try it and see if it works.

Original comment by ch...@adventurecow.com on 2 Nov 2013 at 4:03

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
The new version on Github works with Unicode. Included is a code sample (with 
instructive error on refactoring done by the new team):

>>> import spidermonkey
>>> rt = spidermonkey.Runtime()
>>> cx = rt.new_context()
>>> cx.eval_script(u'"s\u2019te"')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'spidermonkey.Context' object has no attribute 'eval_script'
>>> cx.execute(u'"s\u2019te"')
u's\u2019te'

Original comment by ch...@adventurecow.com on 5 Nov 2013 at 1:28