Converting asp.net project pages from Windows-1251 to Utf-8

I can do this file by file using Save As Encoding in Visual Studio, but I would like to do it with one click. Is it possible?

0


source to share


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


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



0


source







All Articles