]> git.lyx.org Git - lyx.git/blobdiff - src/support/unicode.C
Display error/warning dialogs if possible.
[lyx.git] / src / support / unicode.C
index 0ddeadffbc9c3e8aa02f3422c0ad1333c8158d9a..a9d5a6a634a21a811201dce53b1c8d0fdb7abf80 100644 (file)
@@ -150,10 +150,13 @@ int IconvProcessor::convert(char const * buf, size_t buflen,
                                << " has been encountered in the input.\n"
                                << "When converting from " << fromcode_
                                << " to " << tocode_ << ".\n";
-                       lyxerr << "Input: " << std::hex;
+                       lyxerr << "Input:" << std::hex;
                        for (size_t i = 0; i < buflen; ++i) {
-                               boost::uint32_t const b = buf[i];
-                               lyxerr << "0x" << b << " ";
+                               // char may be signed, avoid output of
+                               // something like 0xffffffc2
+                               boost::uint32_t const b =
+                                       *reinterpret_cast<unsigned char const *>(buf + i);
+                               lyxerr << " 0x" << b;
                        }
                        lyxerr << endl;
                        break;
@@ -162,10 +165,13 @@ int IconvProcessor::convert(char const * buf, size_t buflen,
                                << " has been encountered in the input.\n"
                                << "When converting from " << fromcode_
                                << " to " << tocode_ << ".\n";
-                       lyxerr << "Input: " << std::hex;
+                       lyxerr << "Input:" << std::hex;
                        for (size_t i = 0; i < buflen; ++i) {
-                               boost::uint32_t const b = buf[i];
-                               lyxerr << "0x" << b << " ";
+                               // char may be signed, avoid output of
+                               // something like 0xffffffc2
+                               boost::uint32_t const b =
+                                       *reinterpret_cast<unsigned char const *>(buf + i);
+                               lyxerr << " 0x" << b;
                        }
                        lyxerr << endl;
                        break;