Problem with a Ansi To Oem macro
Submitted by Saturday, 7 May, 2005 - 18:53
on
I am trying to make a macro of conversion ANSI for OEM, and OEM you the ANSI.
The macro works in ANSI to OEM, but does not work ANSI to OEM.
Somebody could help me. the macro is basically this.
Sorry my english.
boolean bAnsiToOem = true;
String[] Ansi = {"â","Â","à ","À","�","ã","Ã","á","ê","Ê","è","é","É",
"Ã","Ã?","õ","Õ","ô","Ô","ó","Ó","ü","Ãœ","ú","Ú","ç","Ç"};
String[] Oem = {"ƒ","¶","…","·","µ","Æ","Ç"," ","ˆ","Ò","Š","‚","?",
"¡","Ö","ä","å","“","â","¢","à ","?","š","£","é","‡","€"};
if(Ansi.length != Oem.length) {
Macros.error(view, "Erro na codificação Ansi ou Oem");
return;
}
for( i=0; i < Ansi.length; i++ ) {
SearchAndReplace.setBeanShellReplace(false);
SearchAndReplace.setIgnoreCase(false);
SearchAndReplace.setRegexp(false);
SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
SearchAndReplace.replaceAll(view);
if(bAnsiToOem){
SearchAndReplace.setSearchString( Ansi[i] );
SearchAndReplace.setReplaceString( Oem[i] );
}else{
SearchAndReplace.setSearchString( Oem[i] );
SearchAndReplace.setReplaceString( Ansi[i] );
}
}
The macro works in ANSI to OEM, but does not work ANSI to OEM.
Somebody could help me. the macro is basically this.
Sorry my english.
boolean bAnsiToOem = true;
String[] Ansi = {"â","Â","à ","À","�","ã","Ã","á","ê","Ê","è","é","É",
"Ã","Ã?","õ","Õ","ô","Ô","ó","Ó","ü","Ãœ","ú","Ú","ç","Ç"};
String[] Oem = {"ƒ","¶","…","·","µ","Æ","Ç"," ","ˆ","Ò","Š","‚","?",
"¡","Ö","ä","å","“","â","¢","à ","?","š","£","é","‡","€"};
if(Ansi.length != Oem.length) {
Macros.error(view, "Erro na codificação Ansi ou Oem");
return;
}
for( i=0; i < Ansi.length; i++ ) {
SearchAndReplace.setBeanShellReplace(false);
SearchAndReplace.setIgnoreCase(false);
SearchAndReplace.setRegexp(false);
SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
SearchAndReplace.replaceAll(view);
if(bAnsiToOem){
SearchAndReplace.setSearchString( Ansi[i] );
SearchAndReplace.setReplaceString( Oem[i] );
}else{
SearchAndReplace.setSearchString( Oem[i] );
SearchAndReplace.setReplaceString( Ansi[i] );
}
}