...and while I'm making this thread unnecessarily long, I should add that
while pymssql may not understand Unicode data, the pyodbc DB-API interface
does. Thanks to recent work by Paul Johnston, it's on fast-track to becoming
the preferred MSSQL db-api for SA.


On 4/10/07, Rick Morrison <[EMAIL PROTECTED]> wrote:
>
> Arghh, that last bit should be chr(146), not ord(146)
>
>
>
> On 4/10/07, Rick Morrison < [EMAIL PROTECTED] > wrote:
> >
> > You've got hi-bit characters in your data. MSSQL with pymssql will store
> > this, but not understand it.
> >
> > You most likely are looking for a "normal" ASCII apostrophe (i.e.
> > ord(39)) instead of the hi-bit version you've got.
> >
> > to get it, try ${str}.replace(ord(146), "'")    <-- that last bit is a
> > single quote (apostrophe) surrounded by double-quotes
> >
> > Rick
> >
> >
> > On 4/10/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > > Hello all -
> > > Unfortunately, we have a ms sql server at work.  When I get tuples
> > > from the server they look like this:
> > >
> > > .. (55, 26, 'Small Business and Individual Chapter 11s - The NewCode
> > > \x92s Effect on Strategies', 'AUDIO'...
> > >
> > > with \x92 for apostrophe etc.  I've tried putting every encoding in
> > > the create_engine statement, including  ISO-8859-1 used by MS SQL, but
> > > the print statements always come out like:
> > >
> > > .. The NewCode?s Effect on ..
> > >
> > > I also tried passing the string to unicode(string, 'ISO-8859-1'), but
> > > this gives me:
> > >
> > > .. UnicodeEncodeError: 'ascii' codec can't encode character u'\x96' in
> > > position 48: ordinal not in range(128) ..
> > >
> > > Does anyone know about MSSQL or this encoding, or how to get
> > > apostrophes where \x92 is?
> > > Any help would be greatly appreciated.
> > >
> > > -Steve
> > >
> > >
> > > > > >
> > >
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to