End of line is cut after first special character by copying

General TRichView support forum. Please post your questions here
Post Reply
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

End of line is cut after first special character by copying

Post by j&b »

I write a text with special (german) characters (ä ö ü ß) in TDBRichViewEdit 12.04 (e.g. 'My name is Jürgen').
Now I copy this text and insert him into a new mail ((format: Rich-Text (HTML)) of winMail.exe.
Inserted Text (of a paragraph) is cut after the first special character.
This also happens with the other paragraphs.

Sample: My name is Jürgen
Copied text is My name is J

If I change format (in winMail) to 'Nur-Text' and insert copied text the whole line is copied (My name is Jürgen)
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Does this problem occur when you copy to WordPad or MS Word?
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Post by j&b »

Sergey Tkachenko wrote:Does this problem occur when you copy to WordPad or MS Word?
This problem occurs when I copy text to MS Word 7.

If I copy text (from TDBRichViewEdit) first to MS Word 7 (+ MS Word 2002) and then I copy text from MS Word 7 (+ MS Word 2002) to eMail all OK.

[img]d:\copy2MsWord.jpg[/img]

(I don't know how to show a picture in this memo thought you give a hint --> [img]http://image_url[/img])
Please tell me how. Picture was save at D:/ (d:\copy2MsWord.jpg).
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Post by j&b »

Sergey Tkachenko wrote:Does this problem occur when you copy to WordPad or MS Word?
No, this problem only occurs when I copy text winMail (outlook)
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

It looks like WinMail has a bug in reading RTF.
Unfortunately, I do not have Windows 7 yet to test.

What version of Delphi do you use? It is important whether you use Unicode text or not, because non-English characters are saved in RTF differently depending on text type.
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Post by j&b »

Sergey Tkachenko wrote:It looks like WinMail has a bug in reading RTF.
Unfortunately, I do not have Windows 7 yet to test.

What version of Delphi do you use? It is important whether you use Unicode text or not, because non-English characters are saved in RTF differently depending on text type.
I use Delphi 7.1 and RichView 12.0.4

If I change in memo.RTFReadProperties UseCharsetToUnicode to YES
text is no langer cut after first special character ('My name is J') therefore special character ('ü') is lost ('My name is Jrgen')
(.UnicodeMode is set to rvrumixed)

In memo.options.rvoCopyAutotext is set to true and
in memo.options.rvoCopyAutoUnicodeText=true'

In memo.RTFOptions.rvRtfDuplicateUnicode ist set to true

And now ?
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I suggest you to use Unicode in RichViewEdit, as explained in http://www.trichview.com/forums/viewtop ... t=70#11569
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Post by j&b »

Sergey Tkachenko wrote:I suggest you to use Unicode in RichViewEdit, as explained in http://www.trichview.com/forums/viewtop ... t=70#11569
I tried about 1 h. Then I start your demo '\RichView\Demos\DelphiUnicode\Editors\Editor 2\REditor.exe'

I put my text (
'Jüäöß and ...'
'My name is Jürgen and I ...')

in (REditor.exe-)memo.

Now I mark and copy (Strg+c) this text to Windows Mail (outlook) and I get then same result:
'J and ...'
'My name is Jrgen and I ...'
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

This demo was created for Delphi 2009-2010.
When loaded in Delphi 7, rve.RTFReadProperties.UnicodeMode = rvruNoUnicode, so, if you paste or insert text as RTF, it will be not Unicode.
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Post by j&b »

Sergey Tkachenko wrote:This demo was created for Delphi 2009-2010.
When loaded in Delphi 7, rve.RTFReadProperties.UnicodeMode = rvruNoUnicode, so, if you paste or insert text as RTF, it will be not Unicode.
No, I've written text character by character ;-))

(in this time once more)
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Please add a button in this demo for saving to RTF
(rve.SaveRTF('test.rtf', False)) and send the resulting RTF to me.
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Post by j&b »

Sergey Tkachenko wrote:Please add a button in this demo for saving to RTF
(rve.SaveRTF('test.rtf', False)) and send the resulting RTF to me.
I have sent the results to you (richview@gmail.com).
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I received your e-mails. I'll try answering tomorrow.
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Post by j&b »

Sergey Tkachenko wrote:I received your e-mails. I'll try answering tomorrow.
Solution from Sergey:

If you use Vista or Win7 and WinMail change RVStyle.DefCodePage to 1252.

By default, this property equals to 0. It should mean "default code page", but it looks like it makes WinMail to ignore all non-English characters.

Normally, DefCodePage property is used to define a code page for conversion between Unicode and non-Unicode text in TRichView.
For example, if you use SearchText to search non-Unicode string, and document is in Unicode, this string will be converted to Unicode using this code page before comparing with Unicode text. Another example of using this code page is storing Unicode document to non-Unicode text file.

If your documents contain only Western text, 1252 is ok (this is a code page for West European languages).
But if, for example, you have a Russian users working with Russian text, they need 1251 code page.
What's why the default value is 0 (system-default code page).
Probably, if you have international users, it makes sense to assign this code page only when copying to WinMail.
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Thanks, j&b.

A little more explanation.
RTF contains \ansicpg keyword specifying a code page to Unicode <--> ANSI conversion. TRichView writes the value of RVStyle.DefCodePage there (because this value has the same meaning in TRichView).
The default value of RVStyle.DefCodePage is 0, meaning CP_ACP. This value instructs to use a system default language (specified in the Control Panel).
This value works ok for all known RTF readers, except for, as it appeared, Vista's WinMail. With this value, WinMail ignores non-English characters in pasted RTF.
I think this is a WinMail bug, but probably I will change my code for compatibility with WinMail. As a quick solution, you can assign a valid code page to RVStyle.DefCodePage, but this will affect all cases of Unicode <--> ANSI conversions in TRichView.
Post Reply