From: Goran on
On Apr 29, 2:42 pm, JY <s...(a)nospamgroup.com> wrote:
> Yes, thanks LimitText() with a higher limit works. But one issue that still
> remains is that the original RTF file that I received from the customer does
> not show up at all in the control. It behaves the same way even with the
> sample from CodeProject I mentioned about yesterday.
>
> I had to open the same document in WordPad and just save it back, and then
> use it.
> I didn't make any other changes in WordPad. But the size of the file dropped
> from 140 KB to 72 KB when I did this.

Check your files in a binary editor. Do it.

Hector told you from the get-go that the file is saved "as Unicode".
Did you check that? That's most likely the reason for all your
trouble. What I often do is to open the file "as binary" in the IDE
and look. Do File->Open->File, use "Open With", then select "binary
editor". If you see FF FE, FE FF, or EF BB BF at the beginning of the
file, it's a Unicode file saved with a BOM (Byte Order Mark) at the
beginning (Windows editors typically use BOM to mark Unicode files).
You will also note that, if it's FF FE at the start, and text is
mostly standard Latin letters, every other byte is 0. That's UTF-16
encoding you're seeing.

If you opened it in write.exe, and just saved it, it's possible that
it saved it "back" as RTF. Since RTF is not unicode, it's likely that
two-bytes per-character (often the case with UTF-16 encooding) went
back to one-byte-per character, hence half the size.

Goran.
From: Joseph M. Newcomer on
See below...
On Thu, 29 Apr 2010 05:42:01 -0700, JY <sd(a)nospamgroup.com> wrote:

>Yes, thanks LimitText() with a higher limit works. But one issue that still
>remains is that the original RTF file that I received from the customer does
>not show up at all in the control. It behaves the same way even with the
>sample from CodeProject I mentioned about yesterday.
>
>I had to open the same document in WordPad and just save it back, and then
>use it.
>I didn't make any other changes in WordPad. But the size of the file dropped
>from 140 KB to 72 KB when I did this.
***
Well, that factor-of-two looks like a Unicode-to-ANSI issue. But in addition, a file that
is written by Word has an AMAZING amount of RTF garbage in it, that will not be retained
if you pass it through WordPad. So until you actually examine the file contents, there's
no way to say which of these two explanations might be valid.
joe
****
>
>- JY.
>
>"Goran" wrote:
>
>> On Apr 28, 4:43 pm, Goran <goran.pu...(a)gmail.com> wrote:
>> > On Apr 28, 3:59 pm, JY <s...(a)nospamgroup.com> wrote:
>> >
>> >
>> >
>> > > "Joseph M. Newcomer" wrote:
>> > > > Although you test the "remaining" field, I don't see where you set it..
>> >
>> > > > Have you single-stepped any of this to see where it is terminating the read, and why? Or
>> > > > put breakpoints on the 'return 1' statements?
>> > > > joe
>> >
>> > > I do it in OnInitDialog(), I missed that line earlier:
>> > > StreamInCookie streamIn;
>> > > streamIn.file = &eulaFile;
>> > > streamIn.remaining = (DWORD_PTR)eulaFile.GetLength();
>> >
>> > > EDITSTREAM es;
>> > > ......
>> > > Yes, I've set breakpoints and noticed that the callbacks don't come after
>> > > some time. At the last point the callback was received, the "remaining" field
>> > > was 36671, and 0 was successfully returned from the callback.
>> >
>> > > The size of the EULA RTF file is quite big, about 13 pages (about 140 KB).
>> > > Not sure if it's got anything to do with the size.
>> >
>> > It seems that file size is the issue. In my test project, I see that I
>> > can read exactly 32kB of text, then it stops calling me back. Meh. Is
>> > that what you see?
>> >
>> > Goran.
>>
>> Obvious resolution (stupid programmer can't find in online help):
>> LimitText with... well, a bigger limit!
>>
>> Goran.
>> .
>>
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
First  |  Prev  | 
Pages: 1 2 3 4 5 6
Prev: Task
Next: compile error note