Change character encoding for existing varchar data from codepage 1252 to codepage 850

  • We have a codepage 850 character data which has been encoded as codepage 1252 and stored in the database. The varchar column in database has collation Latin1_General_CI_AI (codepage 1252). The application has text fields which contain codepage 850 character set data. There is a third party proprietary java ODBC driver which encodes this text into codepage 1252 and stores in database. So, character Ç (ascii code 128, codepage 850) from the application gets stored as character € (ascii code 128, codepage 1252) in the database. Now, we want to get rid of this third party proprietary java ODBC driver and store the cp850 data as is by choosing the appropriate cp850 collation for the varchar column. Also, we want the existing varchar data to be translated back from cp1252 to cp850. From the above example, the character € should be converted back to the character Ç in the varchar column. We tried changing collation of the varchar column from Latin1_General_CI_AI to SQL_Latin1_General_CP850_CI_AI and thought the character conversion would automatically happen but we found that Ç got converted to a question mark (?) which means unsupported character. Please advise on translating the existing data from cp1252 to cp850.

  • Naresh Bharwani - Thursday, April 26, 2018 3:06 AM

    We have a codepage 850 character data which has been encoded as codepage 1252 and stored in the database. The varchar column in database has collation Latin1_General_CI_AI (codepage 1252). The application has text fields which contain codepage 850 character set data. There is a third party proprietary java ODBC driver which encodes this text into codepage 1252 and stores in database. So, character Ã‡ (ascii code 128, codepage 850) from the application gets stored as character € (ascii code 128, codepage 1252) in the database. Now, we want to get rid of this third party proprietary java ODBC driver and store the cp850 data as is by choosing the appropriate cp850 collation for the varchar column. Also, we want the existing varchar data to be translated back from cp1252 to cp850. From the above example, the character â‚¬ should be converted back to the character Ã‡ in the varchar column. We tried changing collation of the varchar column from Latin1_General_CI_AI to SQL_Latin1_General_CP850_CI_AI and thought the character conversion would automatically happen but we found that Ã‡ got converted to a question mark (?) which means unsupported character. Please advise on translating the existing data from cp1252 to cp850.

    Can you change the varchar to nvarchar? Conversions work better with unicode data types.

    Sue

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply