insert value generate special character => xml file contains bulgare language !

  • Hi,

    i'm a beginner with t sql.

    I have a web page where the user can select the language (FR, EN, BG, ...) in a drop down list.

    Next to the drop down list there is a text box where user can type the some text (translation).

    User can add several description

    On my web page, i have a button this button collect all information create an xml file and save all in database (sql server 2008)

    that's work fine for some language => FR, EN and so on

    But for bulgarian (bulgare) and greece there are some problem...

    Some characters when i display it in sql look like => ???s??. ? d??ta?? a?t?

    The value encoded by the user is => Ένωσης. Η διάταξη αυτή

    but the result after t sql xpath is => ???s??. ? d??ta?? a?t?

    I don't know what i can do for to resolve this problem ...

    Any idea ?

    here is it my sql code where you can find my temporary table and my xml file and my xpath query

    declare @tblTranslation table (idDocID int, languageID varchar(10), value varchar(500))

    declare @Translations XML

    set @Translations = '<?xml version="1.0" ?><Items><Item><eleKey>EN</eleKey><eleValue>This is a test</eleValue></Item><Item><eleKey>FR</eleKey><eleValue>test</eleValue></Item><Item><eleKey>BG</eleKey><eleValue>Ένωσης. Η διάταξη αυτή</eleValue></Item><Item><eleKey>HR</eleKey><eleValue></eleValue></Item><Item><eleKey>RO</eleKey><eleValue></eleValue></Item></Items>'

    -- 2) fill the temporary table with information from the xml file

    INSERT INTO @tblTranslation(idDocID, languageID, value)

    SELECT

    1

    , Convert(nvarchar(max), i.query('eleKey/text()')) as colKey

    , Convert(nvarchar(max), i.query('eleValue/text()')) as colValue

    --

    FROM @translations.nodes('/Items/Item') as x(i)

    SELECT * FROM @tblTranslation

    Thanks for your time and your sample

    Christophe

  • For the characters in your example you need to use the data-type "Nvarchar" rather than "varchar".

    This would apply to the column definition in the table, and any parameters in stored procedures etc.

    Mike John

  • Hi,

    thanks a lot that's work fine ..

    thanks thanks you can't imagine i've try to find a solution about this problem while some hours ..

    have a nice day

    christophe

  • Glad to know it sorted the problem - thanks for coming back.

    Mike John

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

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