473,406 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

xerces and UTF-16 encoding

hi,

i've got a little problem with encoding in UTF_16.
i create my document, giving him to my writer to write in a string,
when i set an encoding in UTF-8:

DOMWriter* L_poWriter = L_poImplementation->createDOMWriter();
XMLCh* L_poEncoding = XMLString::transcode( "UTF-8" );
L_poWriter->setEncoding(L_poEncoding);

and then write and get the result:

L_poWriter->writeNode(L_poTarget, *P_poNode);

// WARNING
// using reinterpret cast because the other cast didn't work:
// one day, it's will explode
P_rsResult =
string(
reinterpret_cast<const char*>(
L_poTarget->getRawBuffer()
)
);

the resulting string is valid and contains my Xml.
when i do the same except i encode in UTF-16 the resulting string is
empty

is use xerces v.2.4.0-1.7.0
if you have any idea of what append ?

thanks in advance.
stil

Jul 26 '06 #1
3 2237
On 26 Jul 2006, stil wrote:
Organization: http://groups.google.com

i've got a little problem with encoding in UTF_16.
You are funny! You are posting over Google's Usenet interface
and Google itself cannot read UTF-16. Most hits from
http://www.google.com/search?q=%22UTF+1+6%22
are webpages encoded in UTF-16, but not recognized by Google.
Go to the "Cached" versions!

Why do you want UTF-16 in the first place? UTF-16 and UTF-32
are no good for markup languages with ASCII markup.
UTF-8 is much better suited for XML and HTML.
http://ppewww.ph.gla.ac.uk/~flavell/...checklist.html

Jul 26 '06 #2
In article <11**********************@p79g2000cwp.googlegroups .com>,
stil <da*****@gmail.comwrote:
>the resulting string is valid and contains my Xml.
when i do the same except i encode in UTF-16 the resulting string is
empty
I'm not a C++ programmer, but are you using a char * string to store
your UTF-16 result? If so, it will probably look empty (or just have
one character) because each character will occupy two chars and either
the first of second char will be zero.

-- Richard
Jul 26 '06 #3
you're correct, when i check the resulting raw buffer, it contains the
value but the translation into a string lost the result as the first
character is a \0.

stil

ps: i'm going to try a wstring, i hope it will be better ;)

Richard Tobin a écrit :
In article <11**********************@p79g2000cwp.googlegroups .com>,
stil <da*****@gmail.comwrote:
the resulting string is valid and contains my Xml.
when i do the same except i encode in UTF-16 the resulting string is
empty

I'm not a C++ programmer, but are you using a char * string to store
your UTF-16 result? If so, it will probably look empty (or just have
one character) because each character will occupy two chars and either
the first of second char will be zero.

-- Richard
Jul 26 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bekkali Hicham | last post by:
hi, i have downloaded the latest version 2.4 of Xerces, and unziped it, i end up with a diectory hierarchy like this c:\xerces-2_4_0\XercesImpl.jar c:\xerces-2_4_0\XercesSamples.jar...
0
by: Jim Cobban | last post by:
Due to a problem which I am discussing on another thread the UTF-8 text in my XML file is being corrupted. The problem that leaves me with is that as soon as the Xerces parser hits the bad UTF-8...
0
by: Waseem | last post by:
Hi I have looked and tried everything and i still cant sort this out i have no idea why this wont work I am using Xerces Perl on Windows and Debian to try this and it wont work on both of...
0
by: Jim Phelps | last post by:
After having memory leak issues with Xerces-c 2.3.0 for Solaris 2.7 for CC 6.2 I have decided to update to at least 2.4. I have downloaded the binary tarball and have installed it on my...
0
by: Dale Gerdemann | last post by:
I've been trying to use DOM level 3 with xerces-2_6_2. There's a sample called samples/DOM3.java, but I've had trouble with compilation. I've downloaded Xerces-J-bin.2.6.2 and...
0
by: shaun | last post by:
Xerces-C++ appears to have different methods for 1) Output to file and 2)Output to screen, namely (cut and paste from code): LocalFileFormatTarget target(X(fileName.c_str()));...
18
by: jacksu | last post by:
I have a simple program to run xpath with xerces 1_2_7 XPathFactory factory = XPathFactory.newInstance(); XPath xPath = factory.newXPath(); XPathExpression xp = xPath.compile(strXpr);...
3
by: Matt | last post by:
Hello, Summary: Where can one download a Xerces-C (XML pardser) dynamic library file (.DLL file) for Windows (Win98/WinNT/Win2k/WinXP/Win2003, including server flavors; don't need to support...
2
by: Vlad Zorinov | last post by:
I'm getting the following error after a couple of months of XML processing, using Xerces 2.0.0 in an apache tomcat. Does anyone have any ideas what this problem may be or what I should do to solve...
9
by: mstilli | last post by:
Hi, I am trying to use schema for server side validation using xerces to catch the validation errors. validating this XML: <Content4> <textarea13></textarea13>...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.