views:

809

answers:

2

I can do that file-by-file with Save As Encoding in Visual Studio, but I'd like to make this in one click. Is it possible?

A: 

You can do something similar to what the accepted answer for this question suggests.

Anthony Potts
A: 

I know, some will start bashing on me:

download a smalltalk IDE (such as ST/X), open a workspace, type in:

'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.
].

that will convert all files in the given directory and create corresponding .utf files without affecting the original files. Even if you normally do not use smalltalk, for this type of actions, smalltalk is a perfect scripting environment.

I know, most of you don't read smalltalk, but the code should be readable even for non-smalltalkers and a corresponding perl/python/java/c# piece of code also written and executed in 1 minute or so, taking the above as a guide. I guess all current languages provide something similar to the CharacterEncoder above.

blabla999
why the downvote ? Obviously, there is no one-clock solution; and the above is a 4click solution (1: download; 2:start; 3:paste above code 4:click on the doIt-button). If I had written it as a Python script, no one would have objected - right ? But what is the difference (are you a Smalltalk hater?)
blabla999