Menu

String with blanks

Help
Paulada
2005-09-10
2013-04-24
  • Paulada

    Paulada - 2005-09-10

    Hi,

    I did a client in java that send one string with blanks, just like "Hello world", but the server HelloServer, receives the string like this: "Hello, Hello world."
    How do i receive the correct value with blank?

    I'm using the XmlRpc lib from apache to Java, and the c++ code is the HelloServer with xmlrpc++0.7 and my VS6 is patched.

     
    • Troy (Shellback Tech)

      I had the same problem going from Apache Java to C++ and tracked the problem down to the XmlRpcUtil::xmlDecode method.  The implementation is fairly primitive in that it only looks for five pre-defined URL escapes (<, >, &, ', ") and doesn't look for escaped ASCII characters in the format &#32;.

      Since the space character was the only character getting escaped that I was interested in, I decided to just add another hardcoded escape to their method.  If I hadn't been pressed by my schedule, I would have written a patch that properly looks for &#..; and converts to the correct ASCII char.  I may get around to it in my project's next release.

      A simple fix:
      Look for the declaration of the constants rawEntity, xmlEntity, and xmlEntLen.  Add the appropriate elements to each for the space char.  For example, add:

      ' '        to rawEntity
      "#32;" to xmlEntity
      4        to xmlEntLen

      This should take of the space escape.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.