Problems with unicode

  • I'm having a problem inserting a value into a varchar datatype field,

    the value I'm trying to update a value in a column top 'vič' but when its updated it removes the accent above the c however in the same column there is a value š and the s retains its accent.

    Can anyone explain why, I know I can convert the column to nvarchar and this will sort the problem but i'm confused why one is accepted the other isn't.

    Also if I convert a Varchar datatype column to nvarchar would that alter any of the text at all. 🙂

  • All down to the code page and ASCII conversion.

    select ASCII('š')

    select ASCII('c')

    The first returns ASCII code 154 which is the correct code for that character, but the latter returns ASCII code 99 which is for lowercase C.

    I am guessing that your collation is set to a latin collation and therefore it is converting c to c as c is not a latin ASCII character.

  • Correct its just taking the database collation of Latin_General_CI_AS,

    is there anything which I can do so this value could be updated or would it be a case of changing the collation at a column level or altering it to nvarchar.

    Thanks for the help

  • The only way would be to change the column to NVARCHAR, collation changes may work but then you introduce a whole host of potential problems as certain characters will change making other updates fail.

  • Thanks thats what i'm thinking, never been the most knowledgeable on Collations so this could prove quite catastrophic if I start messing around when really its not required

Viewing 5 posts - 1 through 4 (of 4 total)

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