How to code Unicode strings in VB in dot net?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Hall

    #1

    How to code Unicode strings in VB in dot net?

    When we use the following code, we get ?? on the output.
    Question: How to code the string so we get the Chinese Characters?
    =============== =============== ===========
    <%@ Page Language="VB" ContentType="te xt/html" ResponseEncodin g="iso-8859-1"
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <script language="VB" runat="server">
    sub page_load(obj as object, e as eventargs)
    dim testString as string
    testString = "主 頁"
    lbTest.text = testString
    end sub
    </script>
    <html>
    <head>
    <title>test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <form runat="server">
    <asp:label BackColor="whit esmoke"
    ID="lbTest"
    Text="Fill this in"
    runat="server">
    </asp:label>
    </form>
    </body>
    </html>
    =============== =============== ===========
    --
    John
  • Jon Skeet [C# MVP]

    #2
    Re: How to code Unicode strings in VB in dot net?

    John Hall <JohnHall@discu ssions.microsof t.com> wrote:[color=blue]
    > When we use the following code, we get ?? on the output.
    > Question: How to code the string so we get the Chinese Characters?[/color]

    Well, changing the character set to UTF-8 would be a good start -
    ISO-8859-1 can't encode Chinese characters.

    See http://www.pobox.com/~skeet/csharp/unicode.html for more
    information about encodings.

    --
    Jon Skeet - <skeet@pobox.co m>
    Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

    If replying to the group, please do not mail me too

    Comment

    • John Hall

      #3
      Re: How to code Unicode strings in VB in dot net?

      Humm, OK. Changed to UTF-8. Same results. Displays ??. I will read the
      article further to see if there is more I can do to create a workable unicode
      string of Chinese Characters.

      "Jon Skeet [C# MVP]" wrote:
      [color=blue]
      > John Hall <JohnHall@discu ssions.microsof t.com> wrote:[color=green]
      > > When we use the following code, we get ?? on the output.
      > > Question: How to code the string so we get the Chinese Characters?[/color]
      >
      > Well, changing the character set to UTF-8 would be a good start -
      > ISO-8859-1 can't encode Chinese characters.
      >
      > See http://www.pobox.com/~skeet/csharp/unicode.html for more
      > information about encodings.
      >
      > --
      > Jon Skeet - <skeet@pobox.co m>
      > http://www.pobox.com/~skeet
      > If replying to the group, please do not mail me too
      >[/color]

      Comment

      • Jon Skeet [C# MVP]

        #4
        Re: How to code Unicode strings in VB in dot net?

        John Hall <JohnHall@discu ssions.microsof t.com> wrote:[color=blue]
        > Humm, OK. Changed to UTF-8. Same results. Displays ??. I will read the
        > article further to see if there is more I can do to create a workable unicode
        > string of Chinese Characters.[/color]

        You might also want to read
        http://www.pobox.com/~skeet/csharp/d...ngunicode.html to help to
        isolate the problem.

        --
        Jon Skeet - <skeet@pobox.co m>
        Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

        If replying to the group, please do not mail me too

        Comment

        Working...