Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 291370 - Last Review: August 9, 2004 - Revision: 2.7
FIX: SAX MSXMLWriter Fails to Save Characters Under Certain Encoding
This article was previously published under Q291370
When you call the
parse or
parseURL methods of the
SAXXMLReader to parse XML data that contains characters that cannot be
represented in the output encoding of the Simple API for XML (SAX)
MSXMLWriter, you receive the following error message:
Unable to save character to 'iso-8859-1' encoding. -2147467259
For
example, the error message occurs when the XML data contains the characters
&#B9 FA; &#E1 BB; in GB2312 encoding while the output encoding for the
SAX
MSXMLWriter is set to ISO-8859-1.
The XML data contains a character that cannot be
represented in the ISO-8859-1 character set.
Microsoft
has confirmed that this is a problem in the Microsoft products that are listed
at the beginning of this article.
This
bug was corrected in Microsoft XML 3.0 Service Pack 1.
For additional information on other fixes included in Microsoft
XML 3.0 Service Pack 1, click the article number below to view the article in
the Microsoft Knowledge Base:
292935Â
(http://kbalertz.com/Feedback.aspx?kbNumber=292935/EN-US/
)
INFO: List of Issues Fixed in Microsoft XML 3.0 Service Pack 1
For the latest information and downloads of MSXML,
refer to the following Web site:
The
following file is available for download from the Microsoft Download
Center:
Collapse this imageExpand this image
Download Gb2312.exe now
(http://download.microsoft.com/download/xml/sample/1.0/win98mexp/en-us/gb2312.exe)
Release Date:
Jun-22-2001
For additional information about how to download
Microsoft Support files, click the following article number to view the article
in the Microsoft Knowledge Base:
119591Â
(http://kbalertz.com/Feedback.aspx?kbNumber=119591/EN-US/
)
How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most
current virus-detection software that was available on the date that the file
was posted. The file is stored on security-enhanced servers that help to
prevent any unauthorized changes to the file.
Steps to Reproduce Behavior
- Create the test XML document. To do this, download the
Gb2312.xml file and move the file to the root folder of drive C.
- Create the test project:
- In Microsoft Visual Basic, create a new Standard EXE
project. Form1 is created by default.
- On the Project menu, click to select References, and then select Microsoft ActiveX Data Objects 2.6 Library and Microsoft XML, v3.0.
- Add a CommandButton to Form1. Command1 is added by default.
- Paste the following code into the Click() event for
Command1:
Private Sub Command1_Click()
Dim writer As New MXXMLWriter30
Dim reader As New SAXXMLReader30
Dim adoStr As New ADODB.Stream
adoStr.Type = adTypeBinary
adoStr.Open
writer.output = adoStr
writer.encoding = "iso-8859-1"
On Error GoTo ErrHandler
Set reader.contentHandler = writer
reader.parseURL "c:\gb2312.xml"
Debug.Print adoStr.Size
Set writer = Nothing
Set reader = Nothing
Set adoStr = Nothing
Exit Sub
ErrHandler:
MsgBox Err.Description & Err.Number
End Sub
- Test:
- Press the F5 key to run the Visual Basic
project.
- Click the CommandButton, and note that you receive the following error message:
Unable to save character to 'iso-8859-1' encoding. -2147467259
APPLIES TO
- Microsoft XML Parser 3.0
- Microsoft XML Parser 3.0 Service Pack 1
| kbdownload kbdownload kbbug kbfix kbmsxml300sp1fix kbmsxmlnosweep KB291370 |
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