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 I input Hebrew from winForm to mySql

how I input Hebrew from winForm to mySql

Scheduled Pinned Locked Moved C#
mysqlquestion
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.
  • U Offline
    U Offline
    User 13840722
    wrote on last edited by
    #1

    when i insert hebrew on mySql it goes well but when trying to pest hebrew data from winForm is I get "???" :sigh:

    OriginalGriffO 1 Reply Last reply
    0
    • U User 13840722

      when i insert hebrew on mySql it goes well but when trying to pest hebrew data from winForm is I get "???" :sigh:

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      That's probably more to do with how you are retrieving and displaying it than anything else: "Hebrew" is a part of a characters set, and not all sets will contain the appropriate glyphs for it to display correctly. When it doesn't, one of the displays you get is '?' to indicate it. The big possibility is that you are storing them in a non-UNICODE column in your DB: If it's NVARCHAR it's OK, if it's VARCHAR then it won't work correctly. So start by doing "test inserts": use your existing code to insert a "known good" Hebrew phrase string to SQL, and simultaneously convert it to a byte array:

      byte[] bytes = System.Text.Encoding.UTF8.GetBytes(myHebrewString);

      Then retrieve the same string from the DB (using your existing code) and convert that to a byte array as well. Compare the strings, and compare the byte arrays. If they are the same then the DB and the store / restore code is fine, so you need to start looking at your display code. Sorry, but we can't do any of that for you!

      Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      U 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        That's probably more to do with how you are retrieving and displaying it than anything else: "Hebrew" is a part of a characters set, and not all sets will contain the appropriate glyphs for it to display correctly. When it doesn't, one of the displays you get is '?' to indicate it. The big possibility is that you are storing them in a non-UNICODE column in your DB: If it's NVARCHAR it's OK, if it's VARCHAR then it won't work correctly. So start by doing "test inserts": use your existing code to insert a "known good" Hebrew phrase string to SQL, and simultaneously convert it to a byte array:

        byte[] bytes = System.Text.Encoding.UTF8.GetBytes(myHebrewString);

        Then retrieve the same string from the DB (using your existing code) and convert that to a byte array as well. Compare the strings, and compare the byte arrays. If they are the same then the DB and the store / restore code is fine, so you need to start looking at your display code. Sorry, but we can't do any of that for you!

        Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

        U Offline
        U Offline
        User 13840722
        wrote on last edited by
        #3

        I work with mysql VARCHAR utf8_bin and There is no option of NVARCHAR

        L 1 Reply Last reply
        0
        • U User 13840722

          I work with mysql VARCHAR utf8_bin and There is no option of NVARCHAR

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          Hi, indeed VARCHAR is OK for MySQL; NVARCHAR is an SQL type (e.g. SQLServer) and doesn't exist in MySQL. Did you add Charset=utf8; to your connection string? (ref[^]) :)

          Luc Pattyn [My Articles] Nil Volentibus Arduum

          U 1 Reply Last reply
          0
          • L Luc Pattyn

            Hi, indeed VARCHAR is OK for MySQL; NVARCHAR is an SQL type (e.g. SQLServer) and doesn't exist in MySQL. Did you add Charset=utf8; to your connection string? (ref[^]) :)

            Luc Pattyn [My Articles] Nil Volentibus Arduum

            U Offline
            U Offline
            User 13840722
            wrote on last edited by
            #5

            it's work well Thank you for your time and your support :)

            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