[Zope-xml] Trouble with ParsedXml and ISO-8859-1 char set

Jordi Saludes Closa saludes at ma2.upc.es
Fri Feb 15 03:43:29 EST 2002


> I have trouble using xml-files which contain data
> with special character from Latin-1 (German Umlaute).

>
> Everything works fine as long as I don't use special
> German characters from ISO-8859-1 the char. Then I get
> an UnicodeError. Although I use the encoding="ISO-8859-1"
> attribute in the xml-header.
>
> Is there any other way of putting xml-data in a ParsedXml
> object using dtml-calls?

I had the same problem when using "Upload File" in the Edit tab of ParsedXML, 
but now it goes ok. Check the following:

In python do:

>>> import site
>>> site.encoding

if it is not 'ISO8859-1' but 'ascii' you should activate the use of locale 
encodings at the file 'site.py' in your python library.
In the following fragment, change 'if 0:' to 'if 1:'

encoding = "ascii" # Default value set by _PyUnicode_Init()

if 0:
    # Enable to support locale aware default string encodings.
    import locale
    loc = locale.getdefaultlocale()
    if loc[1]:
        encoding = loc[1]


Hope this works!




More information about the Zope-xml mailing list