probleum in searching special character in vb

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • veer
    New Member
    • Jul 2007
    • 198

    probleum in searching special character in vb

    hi
    i have programe in which works fine for seaching the data from a file
    but when the i want to seach the word like" mögen ". In this word " ö " has some other kind of shap and my programe did not searh it
    please tell me how i will remove this probleum

    varinder
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    Originally posted by veer
    hi
    i have programe in which works fine for seaching the data from a file
    but when the i want to seach the word like" mögen ". In this word " ö " has some other kind of shap and my programe did not searh it
    please tell me how i will remove this probleum

    varinder
    Well here it really depends on the version of visual basic you're using.

    Anyway, in every version, when you open the file, if it's some kind of text file, you'll be able to chose the enconding you'll use to open it: ASCII, UNICODE, UTF8, UTF9, BigEndianUnicod e, etc.

    Perhaps using UTF7 or UTF8, or somekind of the file's default, this problem would be solved

    HTH

    Comment

    • veer
      New Member
      • Jul 2007
      • 198

      #3
      Hi
      thanks for reply
      but i am not understanding , but you are saying
      can you give some code example so that i can search these words

      thanks in advance
      varinder

      Originally posted by kadghar
      Well here it really depends on the version of visual basic you're using.

      Anyway, in every version, when you open the file, if it's some kind of text file, you'll be able to chose the enconding you'll use to open it: ASCII, UNICODE, UTF8, UTF9, BigEndianUnicod e, etc.

      Perhaps using UTF7 or UTF8, or somekind of the file's default, this problem would be solved

      HTH

      Comment

      • VijaySofist
        New Member
        • Jun 2007
        • 107

        #4
        Originally posted by veer
        hi
        i have programe in which works fine for seaching the data from a file
        but when the i want to seach the word like" mögen ". In this word " ö " has some other kind of shap and my programe did not searh it
        please tell me how i will remove this probleum

        varinder
        Hi Varinder!

        Just select this " ö " character from the HTMl File, copy it and paste it in your coding where you are trying to find this letter. It will look like a normal o But in the working process you will find success.

        All the Best

        With Regards
        Vijay. R

        Comment

        • kadghar
          Recognized Expert Top Contributor
          • Apr 2007
          • 1302

          #5
          Originally posted by veer
          Hi
          thanks for reply
          but i am not understanding , but you are saying
          can you give some code example so that i can search these words

          thanks in advance
          varinder
          The encoding is some kind of 'List of characters', in VB Express Edition 2005 there's an example that shows you how to open a text file with different encondings.

          That's useful while working with spanish, for example, because the ASCII or the UNICODE encoding wont support "camión" or "niño". That's why i use 'Default' or UTF7 (or 8)

          About what Vijay says, well, thats true, you can search any character in a string, if you want to search an special character, it's quite simple to paste it in your code or in a textbox (this will allow you to see it as it is), and then search it.

          The problem here is when you import a Text File that says Óscar (my name in spanish), It'll be stored in the string as ?scar, so even if you're able to search the 'Ó' character, it wont be in the string you imported from the text file.

          If you want an example, well, importing text files is a syntax that has changed a lot, but in most of the recent versions, this might be of help:

          [CODE=vb]Public Shared Function ReadAllLines ( _
          path As String, _
          encoding As Encoding _
          ) As String()[/CODE]

          To declare it, and then, while using, you can change the enconding.

          HTH

          Comment

          Working...