Results 1 to 7 of 7

Thread: Can't get this code to display £ chars

Threaded View

  1. #1

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Can't get this code to display £ chars

    I have a simple text file created with notepad and I am trying to load it into a textbox with this code:

    VB Code:
    1. If ofd.ShowDialog = DialogResult.OK Then
    2.             If File.Exists(ofd.FileName) Then
    3.  
    4.                 Dim sr As StreamReader = New StreamReader(ofd.FileName)
    5.                 Try
    6.                     txtOriginal.Text = sr.ReadToEnd
    7.                 Catch ex As Exception
    8.                     MessageBox.Show("Could not load that file: " & ex.Message, "Censor", MessageBoxButtons.OK)
    9.                 Finally
    10.                     'tidy up a bit
    11.                     txtOriginal.SelectionLength = 0
    12.                     sr.Close()
    13.                 End Try
    14.             End If
    15.         End If

    My file has some "£" (British Pounds Sterling symbol, (Shift + 3) on most keyboards.

    The whole file loads ok except for the sterling signs. What gives? If I go out of my way to make it work, save the file in unicode, and try again it works OK, but not all of my files will be in unicode).

    I'm pretty sure it should show EVERY single printable char in the file (regardless of its encoding), in the textbox, yet this is not the case.
    Last edited by wossname; Apr 10th, 2004 at 04:07 PM.
    I don't live here any more.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width