Lars Gullik Bjønnes wrote:
Abdelrazak Younes <[EMAIL PROTECTED]> writes:

| Abdelrazak Younes wrote:
| > Georg Baum wrote:
| >> Abdelrazak Younes wrote:
| >>
| >>> No, I've reverted to 245. Maybe my problem is that lyx doesn't call the
| >>> right lyx2lyx version... I am launching lyx from the scons build tree.
| >>
| >> Running from the build tree works for me. Run it with -dbg package,
| >> and it
| >> will tell you where it tries to find lyx2lyx.
| | I have converted by hand Intro.lyx: | | D:\program\lyx-msvc\Resources\lyx2lyx>python lyx2lyx -t 249 -o
| .\Intro.lyx ..\doc\Intro.lyx
| | The resulting file seems to have the correct version number:
| #LyX 1.5.0svn created this file. For more info see http://www.lyx.org/
| \lyxformat 249
| | But the characters are still displayed in Chinese...

Can you try to change the utf-8 to ucs-4 conversion to use either
"UCS-4BE" or "UCS-4LE", instead of "UCS-4"? Also the conversion the
other way ucs-4 -> ucs-2, try with UCS-2BE and UCS-2LE.

And with the attached patch where I have put LE everywhere, the text is displayed correctly but the inset buttons are not. I guess I have gone too far... we need a conbination of the second patch (unicode_little_endian) and this one (unicode_little_endian_full).

Debug output:

lyx: Disabling LyX socket.
Buff = Introduction to LyX (19)
Res = I n t r o d u c t i o n t o L y X
   (76)
Strange ucs4 value encountered
0x73000000 (0x1224736768) Strange ucs4 value encountered
0x110000000 (0x1845493760) Strange ucs4 value encountered
0x116000000 (0x1946157056) Strange ucs4 value encountered
0x114000000 (0x1912602624) Strange ucs4 value encountered
0x111000000 (0x1862270976) Strange ucs4 value encountered
0x100000000 (0x1677721600) Strange ucs4 value encountered
0x117000000 (0x1962934272) Strange ucs4 value encountered
0x99000000 (0x1660944384) Strange ucs4 value encountered
0x116000000 (0x1946157056) Strange ucs4 value encountered
0x105000000 (0x1761607680) Strange ucs4 value encountered
0x111000000 (0x1862270976) Strange ucs4 value encountered
0x110000000 (0x1845493760) Strange ucs4 value encountered
0x32000000 (0x536870912) Strange ucs4 value encountered
0x116000000 (0x1946157056) Strange ucs4 value encountered
0x111000000 (0x1862270976) Strange ucs4 value encountered
0x32000000 (0x536870912) Strange ucs4 value encountered
0x76000000 (0x1275068416) Strange ucs4 value encountered
0x121000000 (0x2030043136) Strange ucs4 value encountered
0x88000000 (0x1476395008) Buff = by the LyX Team (15)
Res = b   y       t   h   e       L   y   X       T   e   a   m    (60)
Strange ucs4 value encountered
0x98000000 (0x1644167168) Strange ucs4 value encountered
0x121000000 (0x2030043136) Strange ucs4 value encountered
0x32000000 (0x536870912) Strange ucs4 value encountered
0x116000000 (0x1946157056) Strange ucs4 value encountered
0x104000000 (0x1744830464) Strange ucs4 value encountered
0x101000000 (0x1694498816) Strange ucs4 value encountered
0x32000000 (0x536870912) Strange ucs4 value encountered
0x76000000 (0x1275068416) Strange ucs4 value encountered
0x121000000 (0x2030043136) Strange ucs4 value encountered
0x88000000 (0x1476395008) Strange ucs4 value encountered
0x32000000 (0x536870912) Strange ucs4 value encountered
0x84000000 (0x1409286144) Strange ucs4 value encountered
0x101000000 (0x1694498816) Strange ucs4 value encountered
0x97000000 (0x1627389952) Strange ucs4 value encountered
0x109000000 (0x1828716544) Buff = If you have comments or error corrections, ple
ase send them to the LyX Documenta (80)
Res = I f y o u h a v e c o m m e n t s o r e r r o r c o r r e c t i o n s , p l e a s e s e n d t h e m t o t h e L y X D o c u m e n t
  a    (320)
Strange ucs4 value encountered
0x73000000 (0x1224736768) Strange ucs4 value encountered
0x102000000 (0x1711276032) Strange ucs4 value encountered
0x32000000 (0x536870912) Strange ucs4 value encountered
0x121000000 (0x2030043136) Strange ucs4 value encountered
0x111000000 (0x1862270976) Strange ucs4 value encountered
0x117000000 (0x1962934272) Strange ucs4 value encountered
0x32000000 (0x536870912) Strange ucs4 value encountered
0x104000000 (0x1744830464) Strange ucs4 value encountered
0x97000000 (0x1627389952) Strange ucs4 value encountered
0x118000000 (0x1979711488) Strange ucs4 value encountered
0x101000000 (0x1694498816) Strange ucs4 value encountered
0x32000000 (0x536870912) Strange ucs4 value encountered
0x99000000 (0x1660944384) Strange ucs4 value encountered
0x111000000 (0x1862270976) Strange ucs4 value encountered
0x109000000 (0x1828716544) Strange ucs4 value encountered
0x109000000 (0x1828716544) Strange ucs4 value encountered


in unicode.C.

And comment in the commented debug code.


Index: unicode.C
===================================================================
--- unicode.C   (revision 14808)
+++ unicode.C   (working copy)
@@ -177,12 +177,13 @@
 
 std::vector<boost::uint32_t> utf8_to_ucs4(std::vector<char> const & utf8str)
 {
-       //lyxerr << "Buff = " << string(utf8str.begin(), utf8str.end())
-       //       << " (" << utf8str.size() << ")" << endl;
-       //lyxerr << "Res = " << string(res.begin(), res.end())
-       //       << " (" << res.size() << ")" << endl;
+       std::vector<char> res = iconv_convert("UCS-4LE", "UTF-8", utf8str);
 
-       std::vector<char> res = iconv_convert("UCS-4", "UTF-8", utf8str);
+       lyxerr << "Buff = " << string(utf8str.begin(), utf8str.end())
+              << " (" << utf8str.size() << ")" << endl;
+       lyxerr << "Res = " << string(res.begin(), res.end())
+              << " (" << res.size() << ")" << endl;
+
        return bytes_to_ucs4(res);
 }
 
@@ -203,7 +204,7 @@
                lyxerr << std::setw(2) << std::setfill('0') << ((s & 0xff00) >> 
8) << endl;
        }
 
-       std::vector<char> res = iconv_convert("UCS-4", "UCS-2", in);
+       std::vector<char> res = iconv_convert("UCS-4LE", "UCS-2LE", in);
        return bytes_to_ucs4(res);
 }
 
@@ -221,7 +222,7 @@
                in.push_back(static_cast<char>((s & 0x0000ff00) >> 8));
                in.push_back(static_cast<char>(s & 0x000000ff));
        }
-       std::vector<char> res = iconv_convert("UCS-2", "UCS-4", in);
+       std::vector<char> res = iconv_convert("UCS-2LE", "UCS-4LE", in);
        return bytes_to_ucs2(res);
 }
 
@@ -236,7 +237,7 @@
                in.push_back(static_cast<char>((s[i] & 0x0000ff00) >> 8));
                in.push_back(static_cast<char>(s[i] & 0x000000ff));
        }
-       std::vector<char> res = iconv_convert("UCS-2", "UCS-4", in);
+       std::vector<char> res = iconv_convert("UCS-2LE", "UCS-4LE", in);
        return bytes_to_ucs2(res);
 }
 
@@ -249,7 +250,7 @@
        in.push_back(static_cast<char>((c & 0x00ff0000) >> 16));
        in.push_back(static_cast<char>((c & 0x0000ff00) >> 8));
        in.push_back(static_cast<char>(c & 0x000000ff));
-       std::vector<char> res = iconv_convert("UCS-2", "UCS-4", in);
+       std::vector<char> res = iconv_convert("UCS-2LE", "UCS-4LE", in);
        std::vector<unsigned short> us = bytes_to_ucs2(res);
        if (!us.empty())
                return us[0];
@@ -270,7 +271,7 @@
                in.push_back(static_cast<char>((s & 0x0000ff00) >> 8));
                in.push_back(static_cast<char>(s & 0x000000ff));
        }
-       std::vector<char> res = iconv_convert("UTF-8", "UCS-4", in);
+       std::vector<char> res = iconv_convert("UTF-8", "UCS-4LE", in);
        return res;
 }
 
@@ -282,6 +283,6 @@
        in.push_back(static_cast<char>((c & 0x00ff0000) >> 16));
        in.push_back(static_cast<char>((c & 0x0000ff00) >> 8));
        in.push_back(static_cast<char>(c & 0x000000ff));
-       std::vector<char> res = iconv_convert("UTF-8", "UCS-4", in);
+       std::vector<char> res = iconv_convert("UTF-8", "UCS-4LE", in);
        return res;
 }

Reply via email to