[freetds] iconv_t

Mark J. Lilback mark at lilback.com
Fri Apr 11 16:23:00 EDT 2003

At 11:52 AM -0400 4/11/2003, Lowden, James K wrote:
>OS X uses integers instead of strings?  That's intelligent, but I can't
>believe you're the first guy to need a mapping to cannonical names.  How do
>you print the character set name?

There is a function that will return it for you. But check out the declaration:

OSStatus GetTextEncodingName (
     TextEncoding iEncoding,
     TextEncodingNameSelector iNamePartSelector,
     RegionCode iPreferredRegion,
     TextEncoding iPreferredEncoding,
     ByteCount iOutputBufLen,
     ByteCount oNameLength,
     RegionCode oActualRegion,
     TextEncoding oActualEncoding,
     TextPtr oEncodingName

A lot of that is legacy stuff required for pre-Mac OS X when multiple 
encoding support was added on top of traditional MacRoman encoding.

The nice thing with the constants is that they are made up of three 
parts using shifts. The base encoding is something like 
kTextEncodingMacRoman or kTextEncodingUnicodeDefault. Then you add on 
a format such as (for unicode) kUnicode16BitFormat, 
kUnicodeUTF8Format, or kUnicode32BitFormat. Finally, you add on a 
variant such as kUnicodeCanonicalDecompVariant, 
kUnicodeNoComposedVariant, or kUnicodeNoCorporateVariant.

It works pretty nice because they just added variants for the Euro 
sign so you wouldn't get it on old systems, but newer systems would 
return that as part of the default encoding.

iconv does not seems to handle the difference in composed v. 
decomposed unicode. This topic has generated a good bit of discussion 
on some of the mac programming lists, as developers try to fully 
understand unicode.

>  > There also
>  > appears no way to get "the number of non-reversible conversions
>  > performed" that is returned by iconv.
>That's one reason I'm going to change the tds_iconv signature to match
>iconv's.  I have to believe Bruno Haible knows what he's doing, no reason
>not to follow his lead.

But are we actually going to need that information and use it? If 
not, I'd say we don't need it in the signature. Then I don't have to 
worry about how to figure that out.

                                   "They that can give up essential liberty
Mark J. Lilback                    to obtain a little temporary safety
<mark at lilback.com>                 deserve neither liberty or safety."
http://www.lilback.com/                               -- Benjamin Franklin

More information about the FreeTDS mailing list