1.    11 Feb 2010 #1
    Alain Dekker Guest

    Non-Unicode strings in VB.NET?


    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


      My System SpecsSystem Spec

  2.    12 Feb 2010 #2
    Mihai N. Guest

    Re: Non-Unicode strings in VB.NET?


    > 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?
    You don't.
    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

      My System SpecsSystem Spec

  3.    12 Feb 2010 #3
    Patrice Guest

    Re: Non-Unicode strings in VB.NET?


    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
    >
    >
      My System SpecsSystem Spec

  4.    12 Feb 2010 #4
    Markus Betz Guest

    Re: Non-Unicode strings in VB.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 you legacy application likes.

    Markus
      My System SpecsSystem Spec

  5.    12 Feb 2010 #5
    Markus Betz Guest

    Re: Non-Unicode strings in VB.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
      My System SpecsSystem Spec

  6.    13 Feb 2010 #6
    Alain Dekker Guest

    Re: Non-Unicode strings in VB.NET?


    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

      My System SpecsSystem Spec


Similar Threads
Thread Forum
non expandable here strings
Is it possible to use the single quoted form of a here string to create a string that has lines within it that begin with '@ ? I know that this...
PowerShell
How to extract sub-strings?
How can I extract substrings from strings? Especially I am searching for methods to... 1.) extract a substring with a known start position...
VB Script
compare strings
Hi All i am new to VB Script .... I need your help Can any body tell me how i can i compare strings in VB Script right know i am doing it using...
VB Script
question regarding strings
Hi Folks, I am a newbie to windows powershell and am trying to walk a series of text files to compile a cross reference list of sorts. I have...
PowerShell
Using $ signs in strings
Hi, I recently tried to put a $ sign into a string for a variable but it kept coming back as cutting off everything after the $ though it thought...
PowerShell
-f paramater in strings
Just a quick question from a delegate - where is the -f operator documented? And is there a good reference to string formatting within PowerShell...
PowerShell
working with strings
Could someone please explain why this happens like this PS 1 > $a = "_string" PS 2 > $a _string PS 3 > $b = "string $a_string" PS 4 > $b...
PowerShell

Our Sites
  • Ten Forums
  • Eight Forums
  • Seven Forums
  • PC Help Forum
  • Help Me Bake
  • Site Links
  • Contact Us
  • Privacy and Cookies
  • About Us
    Windows Vista Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

    © Designer Media Ltd
    All times are GMT -5. The time now is 06:48.
    .