I've been reading the MSDN documentation on the System.Char and
System.String types and they mention Unicode throughout without even
mentioning non-Unicode versions. How do I get a gool 'ol one-byte char and
non-Unicode string in .NET?
Thanks,
Alain
I've been reading the MSDN documentation on the System.Char and
System.String types and they mention Unicode throughout without even
mentioning non-Unicode versions. How do I get a gool 'ol one-byte char and
non-Unicode string in .NET?
Thanks,
Alain
> I've been reading the MSDN documentation on the System.Char andYou don't.
> System.String types and they mention Unicode throughout without even
> mentioning non-Unicode versions. How do I get a gool 'ol one-byte char and
> non-Unicode string in .NET?
You can get a byte array, but there is no such thing as "non-Unicode string"
--
Mihai Nita [Microsoft MVP, Visual C++]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email
Hello,
Some more context would help.
..NET uses only unicode strings. You could use a byte array. If this is for
interop the conversion can be handled for you (or you could use the
appropriate methods yourself). System.Text.Encoding could also help etc...
What are you trying to do that requires non unicode strings ?
--
Patrice
"Alain Dekker" <abdekker@newsgroup> a écrit dans le message de
groupe de discussion : #Fuft12qKHA.6064@newsgroup
> I've been reading the MSDN documentation on the System.Char and
> System.String types and they mention Unicode throughout without even
> mentioning non-Unicode versions. How do I get a gool 'ol one-byte char and
> non-Unicode string in .NET?
>
> Thanks,
> Alain
>
>
On 10-02-12 16:25, Alain Dekker wrote:Hello Alain,
> I'm communicating with a legacy app that does not support UNICODE. In fact,
> UNICODE is superfluous for this project. Wish there was a way to turn it
> off, but I know and appreciate why its been done.
>
> After your post I found the System.Encoding.ASCII feature and it does what I
> expect. I presume is is transparently handling the second BYTE of each
> two-BYTE character, but for display purposes its fine.
ASCII is restricted to 7 bits. To get the whole lower byte (i.e. the
first 256 chars of Unicode) you should use:
System.Text.Encoding.GetEncoding("ISO-8859-1")
or any other code-set you legacy application likes.
Markus
On 10-02-12 16:25, Alain Dekker wrote:Hello Alain,
> I'm communicating with a legacy app that does not support UNICODE. In fact,
> UNICODE is superfluous for this project. Wish there was a way to turn it
> off, but I know and appreciate why its been done.
>
> After your post I found the System.Encoding.ASCII feature and it does what I
> expect. I presume is is transparently handling the second BYTE of each
> two-BYTE character, but for display purposes its fine.
ASCII is restricted to 7 bits. To get the whole lower byte (i.e. the
first 256 chars of Unicode) you should use:
System.Text.Encoding.GetEncoding("ISO-8859-1")
or any other code-set your legacy application likes.
Markus
Thanks Markus!
"Markus Betz" <dd02@newsgroup> wrote in message
news:4b75cc73$0$6576$9b4e6d93@newsgroup-online.net...
> On 10-02-12 16:25, Alain Dekker wrote:>
>> I'm communicating with a legacy app that does not support UNICODE. In
>> fact,
>> UNICODE is superfluous for this project. Wish there was a way to turn it
>> off, but I know and appreciate why its been done.
>>
>> After your post I found the System.Encoding.ASCII feature and it does
>> what I
>> expect. I presume is is transparently handling the second BYTE of each
>> two-BYTE character, but for display purposes its fine.
> Hello Alain,
>
> ASCII is restricted to 7 bits. To get the whole lower byte (i.e. the first
> 256 chars of Unicode) you should use:
>
> System.Text.Encoding.GetEncoding("ISO-8859-1")
>
> or any other code-set your legacy application likes.
>
> Markus
| Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| non expandable here strings | Larry__Weiss | PowerShell | 1 | 26 Jul 2009 |
| How to extract sub-strings? | Thomas Lebrecht | VB Script | 3 | 28 Mar 2009 |
| compare strings | WebNot | VB Script | 2 | 20 Dec 2008 |
| -f paramater in strings | thomas lee | PowerShell | 4 | 02 Apr 2008 |
| working with strings | ASCHNEIDER146 | PowerShell | 3 | 27 Sep 2007 |