We help IT Professionals succeed at work.

Unprintable characters

fpoyavo
fpoyavo asked
on
487 Views
Last Modified: 2008-03-10
Hi Experts,

I am using as an input file (txt or xml) having unprintable characters in it. The nature of these characters is "foreign words or letters". Any solution to get rid of them I mean replace with equvivalent English ones ? I can use VB, VBScript, Java, JavaScript.

Thank you.
Comment
Watch Question

Commented:
To simply get rid of them:

for each line:
for i=1 to len(currentline)
    if asc(mid(currline,i,1))<20  or asc(mid(currline,i,1))>127 then mid(currline,i,1)=" "   ' or whatever char you want
    next i

Commented:
Oops, the '20' above should have been '31'.


Replacing them would be a bit problematic.

For example, if you suspect Russian, some characters would have to be transliterated into as many as four latin character.

If you simply presume a latin character set, then the easiest thing to to would be to set up a translation table that maps the extended characters (asc() values greater than 127 down to whichever English character you want.

For example:

(again, for each line):

for i=1 to len(currline)
     select case asc(mid(currline,i,1))
              case 0 to 31
                      mid(currline,i,1)=Xlatetable(asc(mid(currline,i,1)))
              case is>127
                      mid(currline,i,1)=Xlatetable(asc(mid(currline,i,1)))
             end select
      next i

xlatetable is an array you would have to set up where xlatetable(N) is the character you want to use when asc(mid(currline,i,1) equals N.

Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Kavar,

I am getting error in this line : (FilePath,1,0,1) --- > message : "invalid procedure call"

??? Any idea ?

Author

Commented:
I fixed that. But another thing is when I write to output it does not like it.

Author

Commented:
I got it.

Commented:
just so I know what was going wrong, what was happening?
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.