Skip to Content.
Sympa Menu

freetds - [freetds] Reading UTF-8 into C/C++ strings

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Ellen Spertus <ellen.spertus AT gmail.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] Reading UTF-8 into C/C++ strings
  • Date: Thu, 16 Dec 2004 10:52:54 -0800

I need to read UTF-8 strings from Microsoft SQL Server into C (gcc
2.95.3). I had gotten almost all the way there when I hit a setback,
which I'm trying to understand. I would be most grateful for any
examples or advice.

I'm using db-lib. I've been setting the charset to "UTF-8" and using
STRINGBIND from a VARCHAR column to a char[]. For a while, I was
(correctly) getting multi-byte sequences in place of non-ASCII
characters (e.g., the trademark symbol). Now I'm getting the single
byte 153 in place of the same non-ASCII character. I believe the
change occurred after I inadvertently closed a terminal window with an
extra Ctrl-D. When I opened a new window (in several different
manners), I could not replicate the old behavior.

Can anyone tell me how to recover the old multi-byte behavior or a
better way to accomplish my goal? (My ideal result would be
converting from UTF-8 to html entity codes.)

Thank you.

Ellen




Archive powered by MHonArc 2.6.24.

Top of Page