1 #include "strutils.hxx"
7 std::string utf8_string1 = "Zweibr\u00FCcken";
8 //valid UTF-8, convertible to Latin-1
9 std::string latin1_string1 = "Zweibr\374cken";
10 //Latin-1, not valid UTF-8
11 std::string utf8_string2 = "\u600f\U00010143";
12 //valid UTF-8, out of range for Latin-1
14 std::string output_string1u = simgear::strutils::utf8ToLatin1(utf8_string1);
15 if (output_string1u.compare(latin1_string1)){
16 std::cerr << "Conversion fail: "
17 << output_string1u << "!=" << latin1_string1;
20 std::string output_string1l = simgear::strutils::utf8ToLatin1(latin1_string1);
21 if (output_string1l.compare(latin1_string1)){
22 std::cerr << "Non-conversion fail: "
23 << output_string1l << "!=" << latin1_string1;
26 std::string output_string3 = simgear::strutils::utf8ToLatin1(utf8_string2);
27 //we don't check the result of this one as there is no right answer,
28 //just make sure it doesn't crash/hang