Microsoft Knowledge Base Email Alertz

KBAlertz.com: (247708) - When you use the loadXML method of the MSXML parser, attempting to include non UTF-16 character sequences in the BSTR parameter passed to loadXML may result in the following error message: An Invalid character was found in text content. Furthermore,...

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]





ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
The ad says 3 - but KBAlertz referrals get
** SIX MONTHS FREE **


Bug Tracking Software
For bug tracking software or defect tracking software or issue tracking software, visit Axosoft.


Community Site



We Send hundreds of thousands of emails using ASP.NET Email



Expert Web Design & Graphic Design
Design44.com

ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
The ad says 3 - but KBAlertz referrals get
** SIX MONTHS FREE **




Mentioned In








Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks




Article ID: 247708 - Last Review: November 17, 2003 - Revision: 3.1

PRB: Strings Passed to loadXML must be UTF-16 Encoded BSTRs

This article was previously published under Q247708

SYMPTOMS

When you use the loadXML method of the MSXML parser, attempting to include non UTF-16 character sequences in the BSTR parameter passed to loadXML may result in the following error message:
An Invalid character was found in text content.

Furthermore, attempting to change the encoding of the string, specifying an "encoding" attribute on the main XML processing instruction, for example results in the following error message:
Switch from current encoding to specified encoding not supported.

CAUSE

The string parameter must be BSTR format. BSTR format strings are always UTF-16.

RESOLUTION

The MSXML 3.0 or later parser does not have this restriction and can accept XML strings with other encodings, such as UTF-8.

To download the latest MSXML parser, go to
http://msdn.microsoft.com/xml (http://msdn.microsoft.com/xml)
The following workarounds are available for parser versions prior to 3.0:

Scripting developers have two options available:

  1. Convert your XML documents to UTF-16-formatted Unicode, either automatically or by hand.Escape all non-Unicode character encodings inside the XML document using XML Unicode entity references. Any XML character can be encoded in plain ASCII using the form &#xxxx, where xxxx is its index into the Unicode character set.
  2. Escape all non-Unicode character encodings inside the XML document using XML Unicode entity references. Any XML character can be encoded in plain ASCII using the form &#xxxx, where xxxx is its index into the Unicode character set.
Microsoft Visual C++ developers have a third option: load data into MSXML using a method other than loadXML. Typical misuse of loadXML results from the desire to load XML data from memory; the IXMLDOMDocument::Load method actually has several overloads that are superior alternatives to loadXML.

See the following Knowledge Base article for more information:
223337  (http://kbalertz.com/Feedback.aspx?kbNumber=223337/EN-US/ ) INFO:Loading/Saving XML Data with Internet Explorer XML Parser

Specifically, the Load method can be passed a SAFEARRAY stuffed full of tasty XML data encoded in any scheme.

STATUS

This behavior is by design.

The MSXML 3.0 or later parser does not have this restriction.

APPLIES TO
  • Microsoft XML Parser 2.0
  • Microsoft XML Parser 2.5
  • Microsoft XML Parser 2.6
Keywords: 
kbbug kbmsxml300fix kbmsxmlnosweep kbprb KB247708
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Be the first to leave feedback, to help others about this knowledge base article.

(Optional) Name

(Optional) Public URL Or Email

Comments
No HTML -- Text Only Please