Converting asp.net project pages from Windows-1251 to Utf-8
2 answers
I know some will start beating me up:
load a small IDE (like ST / X), open a workspace, type:
'yourDirectoryHere' asFilename directoryContentsAsFilenamesDo:[:oldFileName |
|cyrString utfString newFile|
cyrString := oldFileName contentsAsString.
utfString := CharacterEncoder encodeString:cyrString from:#'iso8859-5' into:#'utf'.
newFile := oldFile withSuffix:'utf'.
newFile contents:utfString.
].
which will convert all files to the given directory and create corresponding .utf files without affecting the original files. Even if you don't normally use smalltalk, smalltalk is the ideal scripting environment for this type of action.
I know most of you don't read smalltalk, but the code should be readable even for non-smalltalkers, and the corresponding perl / python / java / C # code is also written and executed in 1 minute or so, taking the above as leadership. I think all current languages ββprovide something similar to the CharacterEncoder above.
0
source to share