Ok I've been struggling with this for days and can't find a solution: suppose I have a python script that uses a utf-8 string, like this:

myString = unicode("canción", "utf-8")

if I run the script in linux it'll work without a problem, but if I run it under windows then "myString" will containt gargabe instead of "ó", I have to manually open the script in windows and change it, this changes encoding when saving the file to iso-8859-1.

I would like to stick with utf-8 for my scripts, but I don't know how to handle this type of characters in windows. One solution I've found is to use native2ascii in my scripts so my strings will be unicode.

I have also tried setting the encoding declaration in the script itself but an exception is throws complaining that I cannot declare the encoding when the script is being evaluated (the whole script is a string). Is there a way to define an encoding for the script that'll be included in a bxml file?


Any help is greatly appreaciated!
Edgar Merino

El 18/07/11 14:27, Edgar Merino escribió:
Hello Sandro, I'll be glad to contribute to the project by porting the Hello World! script example to jython, I'll just need some time until I finish this project, but you can count on it!

Greg, Sandro: I actually found it's an IDE issue, the files are being copied using UTF-8 for it's encoding, I tried filtering the resources using latin1 (iso-8859-1) but I had the same results, I'll see what I can do and I'll let you know the results as soon as I get them.


Thanks for your help!
Edgar Merino

2011/7/16 Sandro Martini <[email protected] <mailto:[email protected]>>

    Hi all,
    Edgar can you attach here a zip containing a minimal sample to see
    the issue ?
    Thank you very much.
    Ah, on apache-extras I've created some time ago an empty project,
    pivot-jython ... are you interested in help us and fill there some
    content (non copyrighted, like some minimal example) ? We already
    have there other projects for other JVM languages ...

    Tell me.

    Bye,
    Sandro

    Il giorno 16/lug/2011 01:30, "Edgar Merino" <[email protected]
    <mailto:[email protected]>> ha scritto:

    > Hello, I've been working on a project using Apache Pivot and
    Python for UI
    > logic. Everything works perfectly, except for encodings. It
    seems that pivot
    > only registeres the default system encoding, excluding all
    others. This is
    > causing me problems since the application I'm writing is suppose
    to run in
    > windows (latin1) and my development machine uses linux (utf-8),
    forcing me
    > to manually change the encoding for strings when making
    production releases.
    >
    > Has anyone got any information on this issue? I'm able to open a
    jython
    > console and use different encodings, but somehow this is not
    working in
    > pivot. Perhaps this is not a pivot issue, but an issue with the
    javax.script
    > API.
    >
    >
    > I hope someone has an answer to this, thanks in advance.
    > Edgar Merino


Reply via email to