5/4/2006 1:29 PM | |
Posts: 102 Rating: (9) |
Hello myfriends I have a VBS function which changes a Unicode string to an Ascii string (128 to 255). Input string is read from a database. In some cases there are some invisible characters (not space) in the input string. In this case I got error message "Type mismatch" in Mid function. I tried to handle the error, using "On Error Resume Next". I have written the attachment code for this purpose: If an error occurs in Mid function, set output string as it is until the error occurs and exit the function. I test the function but it doesn't work properly. My script still terminate after the error occurs. Please check my script, if it is the right way for error handling. Another question is, how I can eliminate those invisible characters. I have already tried Trim, but it can't delete them. Thank you in advance. Attachmentscript.zip (584 Downloads) |
5/8/2006 9:24 AM | |
Posts: 1084 Rating: (72)
|
Mehrnoosh, Evrything working now, or do you still need some help? with regards, ikkezelf |
5/9/2006 9:51 AM | |
Posts: 1084 Rating: (72)
|
Hi, Iwould have thought that this should work. Anyone else that can share some light on this? with regards, Ikkezelf |
5/10/2006 3:40 PM | |
Posts: 102 Rating: (9) |
Dear Salma I read a lot of information from a database I must convert these strings from Unicode to Ascii. I read the string and pass them to the function “unicode2ascii” to convert them. This function read the length of the input string, then I have a “for loop” from 1 to the length or input string, to read each character and convert it. The function works properly for all data except 3 of them in the database. Length of these strings is more than what it seams. For example the “len” function return 19 but it must be 17. So when the “for” reaches to 18, I get a “type mismatch” error on “Mid” function and the function terminates. I tried to eliminate those invisible characters by “Trim” function. But I failed. So I decided to use “On Error Resume Next” function to continue reading other data. Because when the error occurs on 18 I have already my data (as I mentioned the real data is 17 character). Any way I don’t know what to do, so I attached the code again. If you need the table in database or the complete action where I call “unicode2ascii”, let me know. Thank you very much to care about others problems. I really appreciate that. Best Regards Mehrnoosh Attachmentscript.zip (484 Downloads) |
Follow us on