How to know the language of text written in Textbox ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MalikTahirMahmood
    New Member
    • Dec 2009
    • 4

    How to know the language of text written in Textbox ?

    Hi,
    How can we check the language of text entered in the Textbox in ASP.NET, I need to do some calculation based on wether normal english text was entered or UNICODE characters were entered in the TextBox.
  • sanjib65
    New Member
    • Nov 2009
    • 102

    #2
    Multilingual

    You may try the link below

    Build web apps and services that run on Windows, Linux, and macOS using C#, HTML, CSS, and JavaScript. Get started for free on Windows, Linux, or macOS.

    Comment

    • ssnaik84
      New Member
      • Aug 2009
      • 149

      #3
      difficult.. but you can track it with keycode.. check here

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        ASP.NET can pick up on the end user's cultural settings.

        It does this based on browser settings so this idea may not be a perfect fit for you....

        What I was thinking is that you can use the cultural settings to determine what type of text has been entered into the TextBox.

        -Frinny

        Comment

        • ssnaik84
          New Member
          • Aug 2009
          • 149

          #5
          No.. it does not help..
          I have English (US) in browser settings.. but many times I write articles or feedback in Marathi / Hindi..
          धन्यवाद... :)

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #6
            That's what I was commenting about ssnaik84.

            If you set your browser's cultural settings to Marathi/Hindi then it will detect that you prefer to view things in Marathi/Hindi and your web application (if set up correctly) will display resources accordingly. You should be able to use this to determine what language/culture the user is using. (I did this manually before I knew about the automatic stuff that ASP.NET has built in...so I know it's possible but...).

            The problem with this is that the end user will have to be smart enough to set their browsers properly...

            I thought that your browser would pick up on your preferred cultural/language settings based on your operating system's cultural/language. I could be wrong here (?) it would depend on the browser's implementation really.

            I always give the end user a DropDownList of language/cultural options to select from to indicate what language/culture they want to use to view my web application.

            -Frinny

            Comment

            • MalikTahirMahmood
              New Member
              • Dec 2009
              • 4

              #7
              well, very thanks to all of you, But the replies are leading to different direction, Let me explain the scenario again. My application is for sending SMS from PC to phone, There is one text box in which user need to type message, now if user types "English only" text then he can send message of 160 characters, but if he write arabic or some other UNICODE characters then he can send 70 chars." so let suppose " if he write message like " hello world" then it means he wrote only english text so to charge client for english message, but if he write message in arabic language or he wrote some arabic words in between the message then message limit would be applied of 70 chars/Msg.. as this is International standard for text Messaging.. I hope i am able to explain you people to exact problem i am facing..

              Comment

              • Frinavale
                Recognized Expert Expert
                • Oct 2006
                • 9749

                #8
                MalikTahirMahmo od,

                Have you considered providing a DropDownList of all the supported language/cultural options that your application supports?

                If the user doesn't select the right language then their message will be messed up and it's their own fault....

                I'm not sure how to check this server side....(checki ng msdn now)

                Comment

                • Frinavale
                  Recognized Expert Expert
                  • Oct 2006
                  • 9749

                  #9
                  I don't know if this is going to work but have you seen the Encoding.GetEnc oding Method??

                  The thing is that the Encoding class is pretty much used for converting...It 's not really used for checking the Encoding....I don't know how you would do this but I think that looking into the Encoding class would be a good start.

                  -Frinny

                  Comment

                  Working...