--This is used to 'fix' the code page used with "Diccionario" to make --the file "Spanish.txt" readable in Notepad and other text editors --using fonts like "Courier New". One pass only. --Creates the file: "Spanish2.txt". include file.e include get.e include misc.e atom fn,fn2 sequence dirname dirname=".\\" fn=open(dirname&"Spanish.txt","r") fn2=open(dirname&"Spanish2.txt","w") object line integer c,e,pos sequence ch,c_IN,c_OUT --Sequence format: -- ch={ {162, 243} } -- changes code 162 to 243. ch= { {162, 243}, -- o with right back accent {164, 241}, -- n with tilde (n-yay) {160, 225}, -- a with right back accent {163, 250}, -- u with right back accent {181, 193}, -- cap A with right back accent {130, 233}, -- e with right back accent {168, 191}, -- upside down question mark {173, 161}, -- approximately, upside down exclamation point {239, 239}, -- unknown -- leave alone for now {238, 239}, -- double dotted 'i' in 'naive' {249, 249}, -- unknown -- leave alone for now {166, 166}, -- unknown -- leave alone for now {129, 252}, -- double dotted u {161, 237} -- i with right back accent } c_IN=repeat(0,length(ch)) c_OUT=c_IN for k=1 to length(ch) do c_IN[k]=ch[k][1] c_OUT[k]=ch[k][2] end for while 1 do line=gets(fn) if atom(line) then exit end if e=0 for k=1 to length(line) do c=line[k] pos=find(c, c_IN) if pos then if c=161 and line[k+1]=238 then --change {...,161,238,...} combo to double dotted 'i' line=line[1..k-1]&239&line[k+2..length(line)] else c=c_OUT[pos] line[k]=c end if end if if (k+1)>length(line) then --exit here in case line got shorter exit end if end for puts(fn2,line) end while close(fn) close(fn2) printf(1,"%s\n",{"Done."}) sleep(2)