Arne Garvander
1/28/2008 2:27:00 PM
If I try to put non-ANSI data into a string then I am screwed.
Before I got my current contract, someone started to put EBCDIC data into
strings.
No it will take to much effort to clean it up.
--
Arne Garvander
Certified Geek
Professional Data Dude
"Peter Duniho" wrote:
> On Fri, 25 Jan 2008 14:35:11 -0800, Peter Duniho
> <NpOeStPeAdM@nnowslpianmk.com> wrote:
>
> > [...] I made the error of assuming that the call to Convert.ToChar()
> > was doing something that the OP expected, but now I see that it expects
> > Unicode values and so passing what's an ANSI value does actually allow
> > Asc() to return the right thing.
>
> I wrote that, and I'm not even sure what it means. Obviously, passing an
> ANSI value to a method that expects a Unicode value isn't going to do the
> right thing. Not then, not later.
>
> If you pass the correct Unicode value to Convert.ToChar(), you can later
> get the expected ANSI value from Asc(). The Unicode will be converted to
> ANSI for you. But only if you start with the correct, corresponding
> Unicode character in the first place.
>
> But this is a VB-specific thing. I agree that if you're writing .NET
> code, and doing character encoding conversions, that using the actual
> Encoding class is the appropriate solution. It makes it much more clear
> what's going on, and isn't tied to a specific character encoding (the code
> can be easily changed or generalized to use a different encoding than
> ANSI).
>
> Of course, it's not clear from the OP's post that he wanted or expected
> _any_ conversion. In which case, it's really just a matter of avoiding
> the .NET methods in the first place, and sticking to the VB functions that
> deal only in ANSI.
>
> Anyway, sorry for writing that confusing sentence. I wish I know what
> thought I was trying to express at the time. :)
>
> Pete
>