fpoyavo
asked on
Unprintable characters
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.
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.
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)=Xlatetab le(asc(mid (currline, i,1)))
case is>127
mid(currline,i,1)=Xlatetab le(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.
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)=Xlatetab
case is>127
mid(currline,i,1)=Xlatetab
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Kavar,
I am getting error in this line : (FilePath,1,0,1) --- > message : "invalid procedure call"
??? Any idea ?
I am getting error in this line : (FilePath,1,0,1) --- > message : "invalid procedure call"
??? Any idea ?
ASKER
I fixed that. But another thing is when I write to output it does not like it.
ASKER
I got it.
just so I know what was going wrong, what was happening?
for each line:
for i=1 to len(currentline)
if asc(mid(currline,i,1))<20 or asc(mid(currline,i,1))>127
next i