[xsd-users] Encoding 'ru_RU.cp1251' trouble.

Alexander A. Prokhorov prokher at gmail.com
Thu Jul 31 08:18:11 EDT 2008


Hiall.

In there anybody knows is it possible to use xsd serialization for 
non-utf-encoded strings?
This small program gets word from stdin and outputs xml to stdout. It 
coredumps with exception "terminate called after throwing an instance of 
'xsd::cxx::xml::invalid_utf8_string'" if I input word in ru_RU.cp1251 
encoding. How can I fix this?

main.cpp:
{
    std::string word;
    std::cin >> word;
    Hypothesis hypothesis(word);
    Reply reply(hypothesis);
    xml_schema::namespace_infomap map;
    map[""].name = "";
    map[""].schema = "reply.xsd";
    SpellChecker::reply(std::cout, reply, map, "windows-1251");
}


reply.xsd:
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:complexType name="Hypothesis">
    <xsd:sequence>
      <xsd:element name="str" type="xsd:string"/>
    </xsd:sequence>
  </xsd:complexType>
 
  <xsd:complexType name="Reply">
    <xsd:sequence>
      <xsd:element name="hypothesis" type="Hypothesis"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="reply" type="Reply"/>
</xsd:schema>




More information about the xsd-users mailing list