At 7:10 PM -0800 2/22/07, David Glass wrote:
>would the fact that the debugger reports this string as UTF8 when it 
>apparently isn't (2x as long as it should be) be a bug?

No not necessarily. The debugger has no idea if the data in the 
string matches the string's encoding tag.

But tracking down when you first start getting Bytes = 2 x Chars for 
simple ASCII text while the encoding shows UTF-8 will lead you to the 
source of the problem.

>
>When I read the file in it is reported as UTF-8 (in the debugger),
>can I not trust this information?

The file reading functions have no way to know what the encoding of 
the text really is. So it's up to YOU to make sure it's defined 
correctly whenever you bring text into your program, whether via 
file, sockect or database.

I think the file reading functions default to setting the encoding as 
UTF-8, only because that's becoming a common encoding type. But again 
those functions have no idea if the data is actually UTF-8 and you 
need to confirm the encoding actualy used on the source data and set 
the encoding of incoming text appropriately.

>
>As I watch this in the debugger, as the lines come in from the text 
>file they are reported as UTF-8, but when I drag them out of the 
>listbox they are reported as UTF-16.
>
>I know you can't tell me what *specifically* in my code would cause
>that, but what *generically* would cause that?

Yes, that's normal. Some controls internally work with text in a 
specific encoding. When loading text into such conrols, RB will 
automatically convert text to the required encoding AS LONG AS THE 
PREVIOUS ENCODING WAS CORRECT FOR THE ACTUAL TEXT. When taking text 
back out of such a control you may get text still in the internal 
encoding. That's not a problem since the encoding tag will correctly 
identify the new encoding.

Yes, the encoding of text may change just by loading and unloading it 
from a control.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to