trichview.com

trichview.support




Re: Russian Text & RichViewEdit


Return to index


Author

Message

Pieter E.

Posted: 09/28/2004 20:17:24


I found the error.


The error is in the 'for loop'. When I delete the loop, everything works

correct.


I took the 'for loop' from your demo ('International Accents')

Any ideas??


Pieter E.


"Pieter E." <pifiles@hotmail.com> wrote:

>

>It works great!

>

>Still I have a problem...

>I use the following code:

>

>void __fastcall TForm1::FormCreate(TObject *Sender)

>{

>RichViewEdit1->RTFReadProperties->UnicodeMode = rvruOnlyUnicode;  

>for(int i=0; i<RVStyle1->TextStyles->Count; i++)

>{

>  RVStyle1->TextStyles->Items[i]->Unicode = true;

>  //RVStyle1->TextStyles->Items[i]->Charset = RUSSIAN_CHARSET;

>}

>RichViewEdit1->Format();

>}

>//---------------------------------------------------------------------------

>

>When I copy text from the clipboard or IE and I start typing, everything

>works. I can type English text in the Russian text.

>But when I start the application without any text, and I try to type English

>text, I get strange squares. (like this スススススススス)

>

>Do you have a clue?

>

>Thank you.

>

>(It doesn't matter if it is in Russian of English). 

>"Sergey Tkachenko" <svt@trichview.com> wrote:

>>The answer "why it happens" depends on which page you copied from.

>>Depending on this, data may be pasted either in RTF or in plain text format.

>>If content is pasted as RTF, '?????' is not normal, because RTF contains

>>language information.

>>If content is pasted as plain text, '?????' is normal when pasting in

>>non-Unicode editors in Win2k.

>>

>>Technical Information:

>>

>>In Unicode, if you know a character code, you know what this character

is.

>>In non-Unicode text, you must also know the text language. Win2k assumes

>>that the language of the copied text is a language of keyboard at the moment

>>of copying. I believe you have English keyboard layout. So Win2k assumes

>>that the text language is English, and tries to convert the copied

>>characters to English. It's not an application's, it's a Window's feature.

>>You can get the copied text yourself as Clipboard.AsText, you'll see it

>>contains '??????????' instead of Russian characters.

>>

>>Solution:

>>

>>If you need a multilingual application, use Unicode in TRichView.

>>For example, this "Accents" demo is Unicode.

>>What to do:

>>1) Set Unicode property of all text styles to True. In editing operations,

>>all new styles are usually based on existing styles, so they automatically

>>become Unicode.

>>3) Set RichView.RTFReadProperties.UnicodeMode = rvruOnlyUnicode to prevent

>>appearing non-Unicode characters when inserting/loading RTF

>>4) If you have existing RVF files that you need to load, you need to convert

>>them to Unicode (I can give code example)

>>5) Find if you use GetItemText, SetItemText, AddNL, AddTextNL methods and

>>replace them with GetItemTextA, SetItemTextA, AddNLATag, AddTextNLA

>>6) Read topic about Unicode in RichView help file.

>>

>>Without using Unicode, Russian text can be pasted only

>>- if at the moment of copying Russian keyboard layout is active (otherwise

>>'?????????')

>>- current RichViewEdit's text style has RUSSIAN_CHARSET (otherwise

>>characters from the second half of the Western ANSI character codes will

>be

>>used instead of Russian)

>>

>>

>>

>>

>>>

>>> (I use Win2k, TRichViewEdit v1.9.0.4, IE 6.0)

>>>

>>> I create a new Form and drop a RVStyle and RichViewEdit on it.

>>> The I compile the project, copy russian text from IE. The only characters

>>> I see, get are '?'...

>>>

>>> But when I compile the demo 'International Accents' and copy russian

text

>>> from IE, I get the Russian text copied.

>>>

>>> What do I do wrong?

>>>

>>> Thanks.

>>>

>>> Pieter E.

>>

>>

>





Powered by ABC Amber Outlook Express Converter