[freetds] FreeTDS couldn't convert data row's from CP1251 to UTF-8, but field's name is converted

jklowden at schemamania.org jklowden at schemamania.org
Wed Oct 20 10:52:47 EDT 2010


On Wed, Oct 20, 2010 at 06:38:41PM +0600, ?????? ???????? wrote:
> --Table: dbo.adres
> 
> CREATE TABLE dbo.adres (
>   [Column 0]                    varchar(50),
>   [????????? ?????]             varchar(50),
...
>   [Column 25]                   varchar(50)
> )
> GO
> 
> query: select top 5 * from adres
> 
> Problem: FreeTDS couldn't convert data row's from CP1251 to UTF-8, but
> field's name is converted.
> 
> Platform: Win32

Yes, it's a problem.  I'm not sure what to suggest.  

On Win32, FreeTDS uses its built-in iconv to convert to the local character set. The built-in iconv recognizes UCS-2, which is the encoding used for column names.  It does not recognize CP1251.  

Choices: 

1.  CAST/CONVERT data to NVARCHAR on the server.  The client will see UCS-2 data and convert as above.  

2.  Build GNU or other iconv library on Win32, link it with FreeTDS.  Once you have the names straightened out, it should Just Work.  

3.  Use Win32 native functions to convert the data post-binding.  Might not work so well if the built-in iconv already attempted a conversion.  

4.  Extend built-in iconv for CP1251.  Might actually be easiest.  

HTH.

--jkl



More information about the FreeTDS mailing list