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
  1. Home
  2. General Programming
  3. C#
  4. How to read Hebrew letters with StreamReader

How to read Hebrew letters with StreamReader

Scheduled Pinned Locked Moved C#
questioncsharpvisual-studiotutorial
5 Posts 3 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.
  • A Offline
    A Offline
    Admin887
    wrote on last edited by
    #1

    hi, i have a file with Hebrew letters. while reading the file with:

    string s;
    SreamReader SR=new StreamReader(Dir);
    s= SR.readLine();

    the string contains: ����� (something strange) and not hebrew letters. how can i receive hebew letters? i have Microsoft Visual Studio 2008 thank you

    L A 2 Replies Last reply
    0
    • A Admin887

      hi, i have a file with Hebrew letters. while reading the file with:

      string s;
      SreamReader SR=new StreamReader(Dir);
      s= SR.readLine();

      the string contains: ����� (something strange) and not hebrew letters. how can i receive hebew letters? i have Microsoft Visual Studio 2008 thank you

      L Offline
      L Offline
      Lev Danielyan
      wrote on last edited by
      #2

      Is your file Unicode? And where do you get this strange output. Keep in mind that you won't get correct Unicode output in console (try to output in a Label for instance). If your file is not Unicode, try passing the Hebrew encoding to the StreamReader constructor.

      Regards, Lev

      1 Reply Last reply
      0
      • A Admin887

        hi, i have a file with Hebrew letters. while reading the file with:

        string s;
        SreamReader SR=new StreamReader(Dir);
        s= SR.readLine();

        the string contains: ����� (something strange) and not hebrew letters. how can i receive hebew letters? i have Microsoft Visual Studio 2008 thank you

        A Offline
        A Offline
        aleXXXka
        wrote on last edited by
        #3

        tinase leishtamesh be ASCI. yahol lehiot she ze yazor leha: TcpClient newClient; byte[] bytes = new byte[1024]; ns = newClient.GetStream(); bytesRead = ns.Read(bytes, 0, bytes.Length); message = Encoding.ASCII.GetString(bytes, 0, bytesRead);

        L 1 Reply Last reply
        0
        • A aleXXXka

          tinase leishtamesh be ASCI. yahol lehiot she ze yazor leha: TcpClient newClient; byte[] bytes = new byte[1024]; ns = newClient.GetStream(); bytesRead = ns.Read(bytes, 0, bytes.Length); message = Encoding.ASCII.GetString(bytes, 0, bytesRead);

          L Offline
          L Offline
          Lev Danielyan
          wrote on last edited by
          #4

          The answer you provide might be valuable for a lot of people, so please, answer in English.

          Regards, Lev

          A 1 Reply Last reply
          0
          • L Lev Danielyan

            The answer you provide might be valuable for a lot of people, so please, answer in English.

            Regards, Lev

            A Offline
            A Offline
            aleXXXka
            wrote on last edited by
            #5

            Ok :) Did it help you? Try to use ASCI code. In the past i created chat(server and client) that get stream(text) from tcp connection and show it in textbox. TcpClient newClient; NetworkStream ns; string message=" "; byte[] bytes = new byte[1024]; ns = newClient.GetStream(); bytesRead = ns.Read(bytes, 0, bytes.Length); message = Encoding.ASCII.GetString(bytes, 0, bytesRead);

            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