all groups > sql server odbc > january 2005 >
You're in the

sql server odbc

group:

ANSI to Unicode(MSSQL) convertions



ANSI to Unicode(MSSQL) convertions Aras Kucinskas
1/26/2005 12:12:08 PM
sql server odbc: Hi,

How to convert and transfer ANSI string data from FoxPro table to MS SQL
Unicode table. Data in FoxPro are in 1251 codepage (Russian Windows). Now
result is like "ÊÎËÜÖÀ ÊÎÌÏÐÅÑÑÎÐÀ 100ìì ".The ODBC driver does not
performs the conversion from ANSI to Unicode.

Help.

Re: ANSI to Unicode(MSSQL) convertions Anders Altberg
1/26/2005 7:48:33 PM
Does STRCONV() help?
-Anders

[quoted text, click to view]
Re: ANSI to Unicode(MSSQL) convertions Nikolai Lukin
1/27/2005 7:16:30 AM
MS SQL usually stores data in CP-1251 for ru_RU locale by default. Your
example here reads as "compressor ring 100 milimeters" in CP-1251 in fact.
Nevertheless, Activex script mechanism doesn't allow codepage translations,
as I was explained here some time ago. You probably need to add some VB /
VB.NET code to your DTS package. Of course, if you do need to translate your
strings.

Nick

[quoted text, click to view]

Re: ANSI to Unicode(MSSQL) convertions Aras Kucinskas
1/27/2005 8:01:28 AM
Thanks Nick,

What functions I can use for string translation?

[quoted text, click to view]

Re: ANSI to Unicode(MSSQL) convertions Gert E.R. Drapers
1/27/2005 10:57:31 AM
SQL Server stores based on the codepage of the database!

For example:
If your client is using codepage 850 and the database 1250 you will have
automatic conversion.
If your client is using having a ASCII variable stored in codepage 850 and
your stored this in a Unicode column on the server, by default this will get
converted to the server side codepage first. You can also convert it to
Unicode on the client first and insert it, in which case it will got in as
is.

Please read:

International Features in Microsoft SQL Server 2000
http://msdn.microsoft.com/library/en-us/dnsql2k/html/intlfeaturesinsqlserver2000.asp

PRB: SQL Server ODBC Driver Converts Language Events to Unicode (234748)
http://support.microsoft.com/default.aspx?scid=KB;EN-US;234748

INF: SQL Server 7.0 BCP and Code Page Conversion (199819)
http://support.microsoft.com/default.aspx?scid=KB;EN-US;199819


GertD@SQLDev.Net

Please reply only to the newsgroups.
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Copyright © SQLDev.Net 1991-2005 All rights reserved.

[quoted text, click to view]

Re: ANSI to Unicode(MSSQL) convertions Nikolai Lukin
1/28/2005 1:14:04 PM
Here follows some portion of a VB.NET code provided "as is" with absolutely
no warranties. Functions translate a string variable from UTF-8 to ASCII
forth and back. Though code says for itself.

--Quote

Imports System.Text

Public utf8 As Encoding = utf8.UTF8
Public ascii As Encoding = ascii.Default

Public Function Utf8ToAscii(ByVal DataString As String) As String
If DataString = "" Then Return "" Else Return
utf8.GetString(ascii.GetBytes(DataString))
End Function

Public Function AsciiToUtf8(ByVal DataString As String) As String
If DataString = "" Then Return "" Else Return
ascii.GetString(utf8.GetBytes(DataString))
End Function

--Unquote

HTH
Nick

[quoted text, click to view]

Re: ANSI to Unicode(MSSQL) convertions Nikolai Lukin
1/28/2005 1:17:37 PM
Sorry, this should read as:

[quoted text, click to view]

Nick

AddThis Social Bookmark Button