Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. TextBox and odd chars

TextBox and odd chars

Scheduled Pinned Locked Moved C#
4 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Christer Claesson
    wrote on last edited by
    #1

    So, I've tried to do a simple little editor. Works nice with normal text and whatnot, but things like ascii art with its weird characters will not show. They show in notepad but even when I use the same font they refuse to show in the my TextField. Tried a RichTextBox, did not work any good either. So, any clues what I might do. Thank you

    H 1 Reply Last reply
    0
    • C Christer Claesson

      So, I've tried to do a simple little editor. Works nice with normal text and whatnot, but things like ascii art with its weird characters will not show. They show in notepad but even when I use the same font they refuse to show in the my TextField. Tried a RichTextBox, did not work any good either. So, any clues what I might do. Thank you

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      Where is this text coming from? Are you programmatically setting it, or is it just typed in?

      Microsoft MVP, Visual C# My Articles

      C 1 Reply Last reply
      0
      • H Heath Stewart

        Where is this text coming from? Are you programmatically setting it, or is it just typed in?

        Microsoft MVP, Visual C# My Articles

        C Offline
        C Offline
        Christer Claesson
        wrote on last edited by
        #3

        I'm opening a .nfo file or .txt file, so I'm reading it like this: StreamReader reader = File.OpenText(fileName); txbEdit.Clear(); txbEdit.Text = reader.ReadToEnd(); You think that is the thing that makes it weird? Thanks

        H 1 Reply Last reply
        0
        • C Christer Claesson

          I'm opening a .nfo file or .txt file, so I'm reading it like this: StreamReader reader = File.OpenText(fileName); txbEdit.Clear(); txbEdit.Text = reader.ReadToEnd(); You think that is the thing that makes it weird? Thanks

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          First of all, make sure you call Close on your read when you're done. Second, File.OpenText opens files as UTF-8. Any characters above 127 tell the code to read multiple bytes of character data. Below 127 things look like ASCII. What you should do is just use a FileStream and specify the encoding as System.Text.Encoding.ASCII.

          Microsoft MVP, Visual C# My Articles

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups