Menu

#979 Backspace escape char in tag text interpreted and eated text prior it

v1.0 (example)
closed-duplicate
nobody
9
2014-11-30
2014-11-10
No

Environment: gSOAP 2.8.17, gcc4.2, glibc2.3.6 (also reproduced on several other toolchains)

My SOAP method take std::string parameter. If string contain '\b' escape chars then it can lead to move caret to XML text prior head of passed string. E.g. xml should have tag with text body: <username>Alexey</username>. If i pass "\b\b\b\b" instead "Alexey" then tag will be: <usern and i got server error.

Expected behaviour: carete movement should be stopped on first character of string.
https://sourceforge.net/p/gsoap2/bugs/new/#

Discussion

  • Mihail Slobodyanuk

    Sorry for confusion.
    XML tags is not mangled, but server error is appear because invalid XML characters is passed.
    Correct XML should not contain control characters prior ASCII x20 except x9, xA, xD.

    http://www.w3.org/TR/xml/#charsets

    Will be fine to validate it in gSOAP client.

     
  • Robert van Engelen

    Sorry, but enforcing this validation check will prohibit XML serialization of strings. These control characters are silently acceptable to most serializers, in particular those that support the SOAP Encoding style, for this reason. The discussions go a long way back.

    Basically, gsoap is fine with control characters but other XML processors may not and will throw an error. Some tricks and cheats have been tried.

    There is no guaranteed way to ensure control characters can be passed along without running into potential validation errors. Best is to avoid them in strings (when serialized).

    "XML documents consist entirely of characters from the Unicode repertoire. Except for a small number of specifically excluded control characters, any character defined by Unicode may appear within the content of an XML document." http://en.wikipedia.org/wiki/XML

     
  • Robert van Engelen

    • status: open --> closed-duplicate
     

Log in to post a comment.