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. Readline() ignores some characters

Readline() ignores some characters

Scheduled Pinned Locked Moved C#
question
4 Posts 2 Posters 0 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.
  • R Offline
    R Offline
    Rostrox
    wrote on last edited by
    #1

    I have the next code: . . StreamReader inp = new StreamReader(@"c:\inp.txt"); Tx1.Text = inp.ReadLine(); inp.Close(); . . inp.txt contains "¡¡¿¿Test??!!" and after reading line, Tx1 has = "Test??!!" The ¡ and ¿ were ignored!! The same thing occurs with ñ, á, etc. What is happenning? Best regards

    M 1 Reply Last reply
    0
    • R Rostrox

      I have the next code: . . StreamReader inp = new StreamReader(@"c:\inp.txt"); Tx1.Text = inp.ReadLine(); inp.Close(); . . inp.txt contains "¡¡¿¿Test??!!" and after reading line, Tx1 has = "Test??!!" The ¡ and ¿ were ignored!! The same thing occurs with ñ, á, etc. What is happenning? Best regards

      M Offline
      M Offline
      Mazdak
      wrote on last edited by
      #2

      I guess the problem is come from Unicode Encding. Use other cunstructors of StreamReader which you can specify Encoding type in them. Mazy No sig. available now.

      R 1 Reply Last reply
      0
      • M Mazdak

        I guess the problem is come from Unicode Encding. Use other cunstructors of StreamReader which you can specify Encoding type in them. Mazy No sig. available now.

        R Offline
        R Offline
        Rostrox
        wrote on last edited by
        #3

        I made: StreamReader inp = new StreamReader(@"c:\inp.txt",System.Text.Encoding.UTF7); Tx1.Text = inp.ReadLine(); Inp.Close(); and it worked. Thanks. However, it is the firts time I experienced this kind of problem. I live in South America. Now, ¿should I change all my thousands of programs to include this encoding parameter? or is this possible to change it any kind of global parameter? Thanks for your help

        M 1 Reply Last reply
        0
        • R Rostrox

          I made: StreamReader inp = new StreamReader(@"c:\inp.txt",System.Text.Encoding.UTF7); Tx1.Text = inp.ReadLine(); Inp.Close(); and it worked. Thanks. However, it is the firts time I experienced this kind of problem. I live in South America. Now, ¿should I change all my thousands of programs to include this encoding parameter? or is this possible to change it any kind of global parameter? Thanks for your help

          M Offline
          M Offline
          Mazdak
          wrote on last edited by
          #4

          Rostrox wrote: However, it is the firts time I experienced this kind of problem. I live in South America. Now, ¿should I change all my thousands of programs to include this encoding parameter? As far as your programs wants to work with Unicode world ,I think you should apply these change to them. Mazy No sig. available now.

          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