[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Converting non-western characters into Western character

Posted on 2012-04-12
7
Medium Priority
?
420 Views
Last Modified: 2012-04-16
ReplaceChars.xlsxHi there,

I have started to create a VB script file, that accepts a string of characters and then converts them to a set of predefined conversions.

For example, my spec states that whenever a string contains the following character:

À (Latin Capital Letter A with grave)

I need to replace it with :

A

All in all I have over 190 conversions that I need to complete, and i'm not sure I'm going about it in the best manner, hence i call upon your expertise to guide me.

I've attached a spread sheet, and the code that i've made a start on, any pointers would be greatly appreciated.
convertChars.vbs
0
Comment
Question by:Wayne Atherton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 23

Expert Comment

by:basicinstinct
ID: 37836775
this guy reckons he got it working - it's in VB but would be easy enough to translate to VBScript

http://forums.devshed.com/visual-basic-programming-52/remove-accent-characters-367335.html
0
 
LVL 1

Author Comment

by:Wayne Atherton
ID: 37836846
Hi Basicinstinct,

i converted the code as such:


strIn = Objects("InputString").text

    Dim n
    Dim strMid
    For n = 1 To Len(strIn)
        strMid = Mid(strIn, n, 1)
        Select Case Asc(strMid)
        Case 192 - 197:
            strMid = "A"
        Case 198:
            strMid = "AE"
        Case 199:
            strMid = "C"
        Case 200 - 203:
            strMid = "E"
        Case 204 - 207:
            strMid = "I"
        Case 208:
            strMid = "D"
        Case 209:
            strMid = "N"
        Case 210 - 214, 216:
            strMid = "O"
        Case 215:
            strMid = "x"
        Case 217 - 220:
            strMid = "U"
        Case 221:
            strMid = "Y"
        Case 222, 254:
            strMid = "p"
        Case 223:
            strMid = "B"
        Case 224 - 229:
            strMid = "a"
        Case 230:
            strMid = "ae"
        Case 231:
            strMid = "c"
        Case 232 - 235:
            strMid = "e"
        Case 236 - 239:
            strMid = "i"
        Case 240, 242 - 246, 248:
            strMid = "o"
        Case 241:
            strMid = "n"
        Case 249 - 252:
            strMid = "u"
        Case 253, 255:
            strMid = "y"
        End Select
    Next
        Objects("OutputString").text = strIn + strMid


and entered this string as input:

SpecialÁChar

which resulted in this being returned

SpecialÁCharr

which didn't replace the character, and added an additional 'r' to the end of the string.
0
 
LVL 23

Expert Comment

by:basicinstinct
ID: 37836957
you'll have to convert the select case to an if / elseif in vbscript
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 23

Accepted Solution

by:
basicinstinct earned 2000 total points
ID: 37836989
ok i made a start for you, but i got to go make the kids school lunches for tomorrow so i'll post what i got up to (223)

Function Englishizer(strIn)
    Dim strOut
    Dim strMid
    Dim x
    Dim n
    For n = 1 To Len(strIn)
        strMid = Mid(strIn, n, 1)
	x = Asc(strMid)
	if x >= 192 and x <= 197 then
		strMid = "A"
	elseif x = 198 then
		strMid = "AE"
	elseif x = 199 then
		strMid = "C"
	elseif x >= 200 and x <= 203 then
		strMid = "E"
	elseif x >= 204 and x <= 207 then
		strMid = "I"
	elseif x = 208 then
		strMid = "D"
	elseif x = 209 then
		strMid = "N"
	elseif (x >= 210 and x <= 214) or x = 216 then
		strMid = "O"
	elseif x = 215 then
		strMid = "x"
	elseif x >= 217 and x <= 220 then
		strMid = "U"
	elseif x = 221 then
		strMid = "Y"
	elseif x = 222 or x = 254 then
		strMid = "p"
	elseif x = 223 then
		strMid = "B"
	end if
        Englishizer = Englishizer & strMid
    Next
End Function

Open in new window

0
 
LVL 1

Author Comment

by:Wayne Atherton
ID: 37837276
ok, i shall give it a bash.
0
 
LVL 1

Author Closing Comment

by:Wayne Atherton
ID: 37837429
Ok, with my simple test, this seems to work fine. I shall port across in UAT and respond if I need anything further.

thanks for you quick response.
0
 
LVL 1

Author Comment

by:Wayne Atherton
ID: 37851319
For anyone else trying to accomplish the very same thing, i've attached the final VBScript for.

thanks for you asssitance basicinstinct - just save the txt file to .vbs
convertChars.txt
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question