[python-sybase] Unicode SQL

Marcos Sánchez Provencio msanchez at grupoburke.com
24 Feb 2003 21:10:12 +0100


I should have tried first; it seems to work just by initialising the
locale

import locale
locale.setlocale(locale.LC_ALL, '')




El mié, 19-02-2003 a las 13:28, Marcos Sánchez Provencio escribió:
> Hi there.
> 
> ¿Is it possible to issue a query such as "select 'año' "? (in case it
> does not show, between the a and the o there is a n with a ~ on top, a
> very usual char in Spain/España).
> 
> It works from tsql (include with freetds)::
> 
> marcos@cynar:/usr/local/Webware/WebKit$ tsql -Scazalla -Usa
> locale is "es_ES@euro"
> charset is "ISO-8859-15"
> Password: 
> Msg 5703, Level 0, State 1, Server CAZALLA, Line 0
> Changed language setting to us_english.
> 1> select 'año'
> 2> go
> 
> año
> 
> ===================
> Using Python
> 
> SELECT 'año' from usuarios 
> Traceback (most recent call last):
>   File "etcPythonSybase.py", line 227, in ?
>     rs=con.lookup(sql)
>   File "etcPythonSybase.py", line 203, in lookup
>     cur,con=self.lookupRS(sql,params)
>   File "etcPythonSybase.py", line 122, in lookupRS
>     cur.execute(sql)
>   File "/usr/lib/python2.2/site-packages/Sybase.py", line 381, in
> execute
>     self._start_results()
>   File "/usr/lib/python2.2/site-packages/Sybase.py", line 547, in
> _start_results
>     status, result = self._cmd.ct_results()
>   File "/usr/lib/python2.2/site-packages/Sybase.py", line 145, in
> _servermsg_cb
>     raise DatabaseError(_fmt_server(msg))
> Sybase.DatabaseError: Msg 105, Level 15, State 1, Line 1
> Unclosed quotation mark before the character string
> 'a???????????????..?'.Msg 170, Level 15, State 1, Line 1
> Line 1: Incorrect syntax near 'a???????????????..?'.
> ====
> 
> I appreciate any pointers. The client is linux, freetds, the server is
> SQL2000.
> 
> -- 
> Marcos Sánchez Provencio <rapto@arrakis.es>
> 
> _______________________________________________
> Python-sybase mailing list
> Python-sybase@object-craft.com.au
> https://object-craft.com.au/cgi-bin/mailman/listinfo/python-sybase