How can i get the length of a string with Simplified Chinese?

when i use eventwriter to add content to a xmldocument,there are some chinese simplified string in it,i use String.length() for the length ,but it is not correct~how can i get the right length for eventwriter?

Below is a simple patch for this problem. Using this patch you need to pass 0 as the length argument for any XmlEventWriter interfaces that take a string length.
Regards,
George
diff -c dbxml-2.3.10/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp dbxml-2.3.10.patch/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp
*** dbxml-2.3.10/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp    Fri Nov  3 12:26:11 2006
--- dbxml-2.3.10.patch/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp      Thu Mar 15 13:58:13 2007
*** 234,239 ****
--- 234,241 ----
        CHECK_NULL(text);
        CHECK_SUCCESS();
+       if (!length)
+               length = ::strlen((const char *)text);
        if (!_current)
                throwBadWrite("writeText: requires writeStartDocument");
        try {
*** 413,418 ****
--- 415,422 ----
        CHECK_NULL(dtd);
        CHECK_SUCCESS();
+       if (!length)
+               length = ::strlen((const char *)dtd);
        if (_current) {
                if (!_current->isDoc())
                        throwBadWrite("writeDTD: must occur before content");
diff -c dbxml-2.3.10/dbxml/src/dbxml/nodeStore/NsWriter.cpp dbxml-2.3.10.patch/dbxml/src/dbxml/nodeStore/NsWriter.cpp
*** dbxml-2.3.10/dbxml/src/dbxml/nodeStore/NsWriter.cpp Tue Jan  2 16:01:14 2007
--- dbxml-2.3.10.patch/dbxml/src/dbxml/nodeStore/NsWriter.cpp   Thu Mar 15 13:59:25 2007
*** 326,331 ****
--- 326,333 ----
                needsEscape = false;
        else
                needsEscape = true;
+       if (!length)
+               length = ::strlen((const char *)chars);
        writeTextWithEscape(type, chars, length, needsEscape);
*** 336,341 ****
--- 338,345 ----
                              bool needsEscape)
        if(_entCount == 0) {
+               if (!len)
+                       len = ::strlen((const char *)chars);
                if ((type == XmlEventReader::Characters) ||
                    (type == XmlEventReader::Whitespace)) {
                        char *buf = 0;
*** 381,386 ****
--- 385,392 ----
  NsWriter::writeDTD(const unsigned char *data, int len)
        if(_entCount == 0) {
+               if (!len)
+                       len = ::strlen((const char *)data);
                _stream->write(data, len);
  }

Similar Messages

  • I purchased Adobe Acrobat x Pro recently and installed it, I have compatibility issues vision 2013. The adobe pdf converter  plug in stays inactive despite all my efforts to activate it, I need help with this? How can i get the plug in to work with Visio

    I purchased Adobe Acrobat x Pro recently and installed it, I have compatibility issues vision 2013. The adobe pdf converter  plug in stays inactive despite all my efforts to activate it, I need help with this? How can i get the plug in to work with Visio 2013?

    For MS Visio (any version) only the appropriate version of Acrobat *PRO* provides PDFMaker for Visio.
    For Visio 2013 specifically you must have Acrobat XI Pro (updated to at least 11.0.1).
    See: 
    http://helpx.adobe.com/acrobat/kb/compatible-web-browsers-pdfmaker-applications.html  
    Be well...

  • How can i get the "Do recursive listing.vi" with teh sub-vi, because my is lost???

    How can i get the "Do recursive listing.vi" with the sub-vi, because my is lost???
    THX

    I think you must be using LV 8.x...
    Do a LabVIEW repair to get it back or else, use the attached one.
    - Partha
    LabVIEW - Wires that catch bugs!
    Attachments:
    Recursive File List.vi ‏33 KB

  • I synced firefox information to the servers and exchanged my laptop. How can I get the new laptop to sync with my firefox data?

    I want to get my firefox sync data on my laptop. However, I haven't paired this device, I just have my information on the firefox servers under my account. How can I get the sync info on this new laptop?

    If you don't have a 2nd device available which is already setup with your Sync account, pairing can't be done.
    In order to set up a '''new device''' when you can't "pair", you need three things; the user account name ''(email address used)'', the password for the account, and the '''Sync Key'''.
    If you didn't make a copy of the Sync Key as prompted at the end of the Sync set up process, you can't successfully setup a new device and won't be able to recover your data.

  • How can i get the length of a DefaultTreeModel

    i got a tree structure (DefaultTreeModel), now i want to know how many level of this tree, what method can i call to get the length of the tree???

    What sort of TreeNodes do you have in your Tree? If you have DefaultMutableTreeNodes in there then you could call the getDepth method on the root node. That operation is expensive though.
    Good Luck
    Lee

  • How can u get the Length of a file u are going to download?

    HI,<br>
    I have another question, is it possible that u can get the length of a file which u are just going to download?<br>
    <br>
    I have the following code example:<br>
    <br>url = new URL(dlfrom);<br>
    f=new File(url.toURI());<br>
    System.out.println(f.length)();<br><br>
    unfortunatly it keeps throwing an exception, please help.

    RTFM
    http://java.sun.com/j2se/1.5.0/docs/api/java/net/URLCo
    nnection.html#getContentLength()<br>
    I tried to apply your sollution, but it is allways returning -1, so what should I do now, is there any possebility still to get the length of the object, because i thought of doing something similar as a tool to download stuff

  • How can I get the length of a sequence using script

    I am trying to get the length of an image sequence that was imported using importOptions.sequence.  I need to check that the length is a correct number, and if it is too short/long it gives an error message.
    Is there a way to do this?
    Thanks

    //Assumes that your clip is the first item in your project
    var a = app.project.item(1).duration;     //Returns clip length in seconds
    var b = app.project.item(1).frameDuration     //Returns a single frame length in seconds
    var c = a/b;     //If you divide the clip duration by the frameDuration, you should get clip length in frames

  • How can we get the web cam to work with sykpe or any out going calls

    can get the web cam to work with skype

    Hey there,
    What model laptop is this? Are you using the built-in webcam or is this a external web cam? Also what operating system are you using?
    Thanks!
    Sean
    -------------How do I give Kudos? | How do I mark a post as Solved? --------------------------------------------------------

  • How can I get the image data from Clipboard with LV

    Anybody knows How can get the image data after pressd "print screen button" with LV?
    I want to program a software which can save a image as a bmp or jpeg etc, and the image data is from pressed print screen button. 
    How to get it out from clipboard. I am trapping about. thanks in advance.
    Try to make everything Automatic

    You can have a look at Rolf Kalbermatter's post here (give him stars) or, if you're using scripting, you can use the Application class Get Clipboard Image method.
    Try to take over the world!

  • How can I get the size of a file with apple script

    I try to get the size of a file within an apple script. But I did not find information how to do this.

    There are two ways. I think Apple is moving toward using System Events, which is listed first.tell application "Finder"
    set myFile to selection as alias
    --this just gets a file for me to work with
    --coercing it into an alias is required for the other functions
    end tell
    tell application "System Events"
    get size of myFile
    end tell
    set myInfo to (info for myFile)
    get size of myInfo

  • How can I get the dictionary feature to work with firefox?

    I haven't been able to get the dictionary to pop up using the three-finger double-tap in Firefox. Is there is a fix for this?

    Download and install magicPrefs (for free) and do this:
    My guess is that there are problems with gestures yet to be worked out. One problem I see is that users don't wait long enough, or try hard enough (ha!) when using them. My guess is that when the machine is busy (indexing, rendering, etc.) that the gestures get hosed, but I am not a developer...so just a guess

  • How can I get the Firefox browser to work with my high speed internet?

    After switching from dial-up to high speed internet, I can no longer open the Firefox browser (which I was using) even after downloading the latest version. It is set for my default, but I can only use IE to browse. What else do I need to do to make it work?

    You didn't tell me it was a user name password issue.
    Open Keychain Access. (Applications/Utilities)
    Select Passwords on the left.
    Delete the Delta keychain.
    Now from your Safari menu bar click Safari / Preferences then select the Autofill tab. Make sure:  User names and passwords is selected.
    Navigate to the Delta site. Login with your user name and password. You should be prompted to save that info to a new keychain.

  • I purchased Adobe Acrobat x Pro recently and installed it, I have compatibility issues vision 2013. The adobe pdf converter  plug in stays inactive despite all my efforts to activate it, I need help with this? How can i get the plug in

    I purchased Adobe Acrobat x Pro recently and installed it, I have compatibility issues vision 2013. The adobe pdf converter  plug in stays inactive despite all my efforts to activate it, I need help with this? How can i get the plug in to work with Visio 2013?

    For MS Visio (any version) only the appropriate version of Acrobat *PRO* provides PDFMaker for Visio.
    For Visio 2013 specifically you must have Acrobat XI Pro (updated to at least 11.0.1).
    See: 
    http://helpx.adobe.com/acrobat/kb/compatible-web-browsers-pdfmaker-applications.html  
    Be well...

  • How can i get the Adobe plug in to work with Visio 2013?

    I purchased Adobe Acrobat x Pro recently and installed it, I have compatibility issues visio 2013. The adobe pdf converter  plug in stays inactive despite all my efforts to activate it, I need help with this? How can i get the plug in to work with Visio 2013?

    Should have purchased XI. According to Compatible web browsers and PDFMaker applications you will need Acrobat 11.0.1 -and- to be running the 32-bit Visio.

  • How can I get the path of an existing file????

    Hi.
    I'm a newbie in Jsp development, so this question may appear trivial.
    How can I get the path into a String of an exixting file ..like ...
    String thepath = path_of("my file.txt");
    Thanks for your help.

    Try
    application.getRealPath("myFile.txt")

Maybe you are looking for

  • Display pdf of an xstring directly in ERP

    Hi, I am trying to generate a pdf-file out of an xstring-object which I got from the pdf creation in webdynpro. I want to display the pdf directly in the erp-system. Does anybody know how to convert the xstring to pdf and how to directly show the pdf

  • I can't upgrade my macbook mid 2007 to maverick its because is to old ? help me  guys

    i need help guys i dont know why i can not upgrade my macbook 13-inch mid 2007 from os x lion 10.7.5 to maverick

  • VA42 user exit to update contract start and end dates at header

    Hi. My requirement : In VA42, if a user changes a contract end date at item level, I want the change to be reflected at header level automatically. I have looked in MV45AFZZ, USEREXIT_SAVE_DOCUMENT and USEREXIT_SAVE_DOCUMENT_PREPARE. I am unable to a

  • HTML Widget, not showing up

    I'm experimenting with using a link to a movie on blip.tv. I have a Movies page with thumbnails and a series of Entries pages. I've copied the <embed> code from blip to the relevant Entries page and the movie appears as expected in the iWeb editor. H

  • How to distribute a value across time periods?

    <p>I have an application that tracks employees' actual andforecasted time on a project. The question is how do I get startedon writing a business rule to distribute forecasted time acrosstime periods?</p><p> </p><p>For example, the user selects an em