Hi,

we are using STAX V3.5.0 Beta 1 and STAF 3.4.5 on a Linux x86_32.

Here is some more info from the server:

# echo $LANG
de_DE.UTF-8
# staf local VAR RESOLVE STRING {STAF/Config/CodePage}
Response
--------
UTF-8
#

The appended STAX-file written in UTF-8 defines a string containing a
German "Umlaut o". When it tries to write this string to STAXMon or
Job_User_Log using Jython print or <log>,  an error is thrown (Msg from the 
Job_Log):

20110620-14:44:57 Error STAXPythonEvaluationError signal raised. Terminating 
job.

===== XML Information =====

File: /home/STAF/emach/testit.xml, Machine: local://local
Line 6: Error in element type "script".

===== Python Error Information =====

com.ibm.staf.service.stax.STAXPythonEvaluationException:
Traceback (most recent call last):
  File "<pyExec string>", line 5, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 4: 
ordinal not in range(128)

===== Call Stack for STAX Thread 1 =====

[]


Then I inserted
            # -*- coding: utf-8 -*-
as the first line of the first <script>. That results in an error when starting 
the script (note: in this message the
"Umlaut o" is displayed correctly on the screen):

            Error submitting request, RC: 4001
Additional info
---------------
Job ID       : 50
Error Message: Caught com.ibm.staf.service.stax.STAXPythonCompileException:
File: /home/STAF/emach/testit.xml, Machine: local://local
Line 6: Error in element type "script".

Python code compile failed for:
# -*- coding: utf-8 -*-

print "Let's start the test\n"

mystring = u"Störung.am.Netz"

print "1 " + mystring + '\n'



SyntaxError: Illegal character in file '<string>' for encoding 'utf-8'




Is there a way to use UTF-8 in STAX consistently? Am I doing something wrong?

Thanx in advance
Bodo

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "stax.dtd">

<stax>

  <script>

    print "Let's start the test\n"

    mystring = u"Störung.am.Netz"

    print "1 " + mystring + '\n'

  </script>

  <defaultcall function="EMACH_main"/>


<!-- ####################################################################### -->

  <function name="EMACH_main" scope="global">

  <sequence>

    <script>

      print "2 " + mystring + '\n'

    </script>

    <log message="True">
       "3 " + mystring
    </log>

  </sequence>

  </function>

<!-- ############################################################################ -->

</stax>
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to