Error: Unable to switch encoding

  • I'm trying to load xml files into table with xml column in sql. getting the below error when i execute SSIS package.

    *******

    [OLE DB Destination [42]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.

    An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "XML parsing: line 1, character 43, unable to switch the encoding".

    *****

    I have encoding="ISO-8859-1" in xml file and using SQL Server 2008R2.

    I know problem with the encoding problem but i cant change encoding in XML files. Can anyone suggest me how to store data without changing encoding..

    Thanks in advance!

    Kumar

  • Can you provide a sample of the XML? Anonymized, of course. That would make it easier to see what's going on.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Here it is:

    <?xml version="1.0" encoding="ISO-8859-1" ?>

    - <!-- ArborText, Inc., 1988-2001, v.4002

    -->

    - <doc>

    - <topics>

    <topic id="T87478">text</topic>

    <topic id="T12642">text</topic>

    <topic id="T82199">text</topic>

    <topic id="T52645">text</topic>

    </topics>

    .

    .

    ..

    .

    Any idea...! error is at encoding in first line..

  • I've seen this happen when the file was a single-byte encoded file but was saved as Unicode. Open the file and save it as non-unicode and try it again.


    And then again, I might be wrong ...
    David Webb

  • Okay. Looks like you have a character in the XML that doesn't fit within that encoding. It's pretty limited, so if the file has anything like some of the special quotation marks, or any non-Latin character-set data, it will give an encoding error. Could be as simple as the French CE (with the C & E merged together).

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

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

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