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.

With the attached patch (2BE) the characters are still chinese and I have these debug output:

Buff = Introduction to LyX (19)
Res = I n t r o d u c t i o n t o L y
 X (76)
Buff = by the LyX Team (15)
Res =    b   y       t   h   e       L   y   X       T   e   a   m (60)
Buff = If you have comments or error corrections, please send them to the LyX Do
cumenta (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)
Buff = tion mailing list, <[email protected]>. (44)
Res = t i o n m a i l i n g l i s t , < l y x - d o c s @ l i s t s . l y x
 .   o   r   g   >   . (176)
Buff = The Philosophy of LyX (21)
Res =    T   h   e       P   h   i   l   o   s   o   p   h   y       o   f
 L   y   X (84)
Buff = Uncle Cosmo, why do they call this a word processor? (52)
Res = U n c l e C o s m o , w h y d o t h e y c a l l t h i s a w
 o   r   d       p   r   o   c   e   s   s   o   r   ? (208)
Buff = It's simple, Skyler. (20)
Res = I t ' s s i m p l e , S k y l e
 r   . (80)
Buff =  You've seen what food processors do to food, right? (52)
Res =        Y   o   u   '   v   e       s   e   e   n       w   h   a   t
f o o d p r o c e s s o r s d o t
 o       f   o   o   d   ,       r   i   g   h   t   ? (208)
Buff = --- Jeff MacNelly in  (21)
Res =    -   -   -       J   e   f   f       M   a   c   N   e   l   l   y
 i   n     (84)
Buff = Shoe (4)
Res =    S   h   o   e (16)
Buff =   (1)
Res =      (4)
Buff = What is LyX? (12)
Res =    W   h   a   t       i   s       L   y   X   ? (48)
Buff = LyX is a document preparation system. (37)
Res =    L   y   X       i   s       a       d   o   c   u   m   e   n   t
p r e p a r a t i o n s y s t e m . (148)

Buff = It excels at letting you create complex technical and scientific article
s (74)
Res = I t e x c e l s a t l e t t i n g y o u c r e a t e c o m p l e x t e c h n i c a l a n d s c i
 e   n   t   i   f   i   c       a   r   t   i   c   l   e   s (296)
Buff = with mathematics, cross-references, bibliographies, indices, etc. (66) Res = w i t h m a t h e m a t i c s , c r o s s - r e f e r e n c e s , b i b l i o g r a p h i e s , i n d i c
 e   s   ,       e   t   c   . (264)
Buff = It is very good at documents of any length in which the usual processing
 (73)
Res = I t i s v e r y g o o d a t d o c u m e n t s o f a n y l e n g t h i n w h i c h t h e u
 s   u   a   l       p   r   o   c   e   s   s   i   n   g (292)
Buff = abilities are required: automatic sectioning and pagination, spellchecki
ng, (76)
Res = a b i l i t i e s a r e r e q u i r e d : a u t o m a t i c s e c t i o n i n g a n d p a g i n a t i
 o   n   ,       s   p   e   l   l   c   h   e   c   k   i   n   g   ,
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-4BE", "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);
 }
 
@@ -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-2BE", "UCS-4", 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-2BE", "UCS-4", 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-2BE", "UCS-4", in);
        std::vector<unsigned short> us = bytes_to_ucs2(res);
        if (!us.empty())
                return us[0];

Reply via email to