By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,490 Members | 1,489 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,490 IT Pros & Developers. It's quick & easy.

probleum in searching special character in vb

100+
P: 198
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" mgen ". 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
Apr 24 '08 #1
Share this Question
Share on Google+
4 Replies


kadghar
Expert 100+
P: 1,295
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" mgen ". 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, BigEndianUnicode, etc.

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

HTH
Apr 24 '08 #2

100+
P: 198
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

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, BigEndianUnicode, etc.

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

HTH
Apr 25 '08 #3

VijaySofist
100+
P: 107
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" mgen ". 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
Apr 25 '08 #4

kadghar
Expert 100+
P: 1,295
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 "camin" or "nio". 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:

Expand|Select|Wrap|Line Numbers
  1. Public Shared Function ReadAllLines ( _
  2.     path As String, _
  3.     encoding As Encoding _
  4. ) As String()
To declare it, and then, while using, you can change the enconding.

HTH
Apr 25 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.