[Info-ingres] Fw: replacing special characters eg ä in SQL with a unicode script u'ä'

Chris Clark chris.clark at actian.com
Thu Apr 14 16:23:12 UTC 2016


On Thursday, April 14, 2016 at 9:04:04 AM UTC-7, Allan Biggs wrote:
> I am a python novice I am just using
> it via http://xlsxwriter.readthedocs.org/
> to produce a .xlsx spreadsheet  - the Ä
>     went directly to the python code which objected to it. when
> it was run 
...

> 
> this ..... 
> 
> worksheet1.write(  43,
>   0,'xxxx' u'®'  'and xxxx' u'®'  ' are registered trademarks
> of xxxxxxxxx.' ,format0)


Two options (there are others but these are least effort):
1) you could use Actian Director to generate exports
2) change the python code you emit - which is sounds like this would be your preferred options

For 2) there are two further options (one may not work):

a) Just use a str type (and use Python 2.x) - there is a chance xlsxwriter may check the type and fail
b) Just use a str type and convert to unicode, e.g.:


    worksheet1.write(43, 0, 'xxxx ® and xxxx® are registered trademarks of xxxxxxxxx.'.decode('utf8') ,format0)


i.e.:

    'xxxx' u'®'  'and xxxx' u'®'  ' are registered trademarks of xxxxxxxxx.'

becomes

     'xxxx ® and xxxx® are registered trademarks of xxxxxxxxx.'.decode('utf8')




More information about the Info-ingres mailing list