DEADSOFTWARE

Fix 16-bit string handling -- still don't know the encoding
authorGert van Valkenhoef <g.h.m.van.valkenhoef@rug.nl>
Mon, 14 Nov 2011 10:06:58 +0000 (10:06 +0000)
committerGert van Valkenhoef <g.h.m.van.valkenhoef@rug.nl>
Mon, 14 Nov 2011 10:06:58 +0000 (10:06 +0000)
odcread.cc

index caa87e7713f0dc937cd24c717c54dbbc2add4160..fc210a8a10c59f5cc0e0660a711a702114b2bc9e 100644 (file)
@@ -115,18 +115,19 @@ namespace odc {
                        d_context.top()->addPiece(str);
                }
                virtual void textLongPiece(const LongPiece *piece) {
+               /*      
                        char *out = (char*)piece->getBuffer();
                        std::string str(out);
                        d_context.top()->addPiece(str);
+               */
                        //d_convLong = iconv_open(setlocale(LC_CTYPE, 0), "UCS-2");
-                       /*
-                       iconv_t conv = iconv_open("UTF-8", "UTF-8");
+                       iconv_t conv = iconv_open("UTF-8", "UCS-2");
                        if (conv == (iconv_t)-1) {
                                std::string str("iconv initialization error: ");
                                str += strerror(errno);
                                throw str.c_str();
                        }
-                       size_t bytesIn = piece->size() + 1;
+                       size_t bytesIn = piece->size() + 2;
                        char *in = (char*)piece->getBuffer();
                        size_t bytesOut = bytesIn; // FIXME probably not safe.
                        char *out = new char[bytesIn];
@@ -142,7 +143,7 @@ namespace odc {
                        for (std::string::iterator it = str.begin(); it < str.end(); ++it) {
                                if (*it == '\r') *it = '\n';
                        }
-                       d_context.top()->addPiece(str);*/
+                       d_context.top()->addPiece(str);
                }
        };