W3C home > Mailing lists > Public > public-cwm-talk@w3.org > July to September 2011

Fw: unicode error

From: <jos.deroo@agfa.com>
Date: Thu, 28 Jul 2011 09:33:32 +0200
To: public-cwm-talk@w3.org
Message-ID: <OFCD873741.78EEA1EB-ONC12578DB.002985E4-C12578DB.002985E6@agfa.com>
[Forwarded on behalf of Giovanni who had trouble to send..]

Kind regards,

Jos De Roo | Agfa HealthCare
Senior Researcher | HE/Advanced Clinical Applications Research
http://www.agfa.com/w3c/jdroo
http://twitter.com/josderoo

Agfa HealthCare NV, Moutstraat 100, B-9000 Gent, Belgium
http://www.agfa.com/healthcare

-----Forwarded by Jos De Roo/AMDUS/AGFA on 07/28/2011 09:29AM -----
To: Jos De Roo/AMDUS/AGFA@AGFA
From: Giovanni Mels/AMCOH/AGFA
Date: 07/28/2011 09:25AM
Subject: Fw: unicode error



Kind Regards,

Giovanni Mels | Agfa HealthCare
Software Designer | HE/Advanced Clinical Applications Research
T  +32 3444 8446 | F  +32 3 444 8401

Agfa HealthCare NV, Moutstraat 100, 9000 Gent, Belgium
http://www.agfahealthcare.com
Click on link to read important disclaimer: http://www.agfahealthcare.com/maildisclaimer ----- Doorgestuurd door Giovanni Mels/AMCOH/AGFA op 28/07/2011 09:25 -----

Van:	Giovanni Mels/AMCOH/AGFA
Aan:	public-cwm-talk@w3.org
Datum:	26/07/2011 17:18
Onderwerp:	unicode error


Hello,

cwm gives an error when parsing N3 files containing data typed literals with unicode characters:

<#x> <#y> "H\u00E4matologie"^^<#d>.
and 
<#x> <#y> "Hämatologie"^^<#d>.
both fail to parse and give:
"UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 1: ordinal not in range(128)"

The patch below fixes this (changed str() to unicode())Index: cwm/swap/pretty.py
===================================================================
--- cwm/swap/pretty.py	(revision 11687)
+++ cwm/swap/pretty.py	(working copy)
@@ -52,7 +52,7 @@
         return (XMLLITERAL, x.dom)
     if isinstance(x, Literal):
         if x.datatype:
-            return LITERAL_DT, (str(x), x.datatype.uriref()) # could be XMLLit
+            return LITERAL_DT, (unicode(x), x.datatype.uriref()) # could be XMLLit
         if x.lang:
             return LITERAL_LANG, (x.string, x.lang)
         return (LITERAL, x.string)

Kind Regards,

Giovanni Mels | Agfa HealthCare
Software Designer | HE/Advanced Clinical Applications Research
http://www.agfahealthcare.com
Click on link to read important disclaimer: http://www.agfahealthcare.com/maildisclaimer 
Received on Thursday, 28 July 2011 07:34:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 28 July 2011 07:34:25 GMT