As you may now, CPS is for the time being a pure latin9 (iso-8859-15) application. Unfortunately, we may encounter problems with text written on computers running MS Windows, since they use another encoding: cp1252, and some cp1252 characters can't be translated to latin9. The most common of these is 0x92 (looks like a single quote), which is sometimes used as a french 'apostrophe'.

Since the svn checkin [30067], CPS has the capability to replace those characters with a latin9 *approximation*
It can be used as follows:
    unitext.encode('iso-8859-15', 'latin9_fallback')
where 'unitext' is a Unicode object that may contain one of those characters.

For more details, see the docstring of winToLatin9_errors in
    http://svn.nuxeo.org/trac/pub/file/CPSUtil/trunk/text.py
Please remember that this is just an approximate, it cannot be accurate, so use it with care.

We also removed two almost useless functions from CPSUtil.text
      winToUnicode(mystring) :  use mystring.decode('cp1252') instead
winToLatin9(mystring) was mostly equivalent to: mystring.decode ('cp1252').encode('iso-8859-15', 'xmlcharrefreplace')

---------
Georges Racinet                        Nuxeo SAS
[EMAIL PROTECTED]                http://nuxeo.com
Tel: +33 (0) 1 40 33 71 73


_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel

Reply via email to