Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 782
  • Last Modified:

batch open and save

Hello
I have hundreds of html files that I need to re-open and resave as utf-8. Does anyone know of a way I could do this without having to open each one in notepad and resaving it?
Thanks
0
avir
Asked:
avir
  • 3
  • 2
1 Solution
 
h4miCommented:
0
 
avirAuthor Commented:
Looks promising. I'll give it a try.
0
 
avirAuthor Commented:
The reason why I have to do this is because the files contain Hebrew text which isn't being detected automatically until I change the encoding until I change the encoding in the browser.  I found that when I open a file and resave it with the utf-8 encoding as All Files then it is displayed correctly.
Unfortunately when I run this program,  it turns the Hebrew text that I have in the files into gibberish.
Any other ideas?
0
 
h4miCommented:
Do you have the charset tag in your html files?
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
Change utf-8 to the proper charset. Full list can be found here:
http://www.iana.org/assignments/character-sets

Of course, this is not easier than just saving the files in utf-8.
Here is another more manual way of doing it.

1. Download notepad++ from http://notepad-plus-plus.org/download
2. Open a couple of the files in the program
3. Macro>start recording
4. Encoding>change the charset
5. Save the file
6. Close the file
7. Macro>stop recording
8. Open all the files
9. Macro>Run a macro multiple times
10. Enter the amount of files and run

Of course, you should try on one file first in case it turns into gibberish again or similar.
0
 
avirAuthor Commented:
I actually don't have the charset tag in the files and I didn't even notice, but thanks for pointing that out. So I'm opening all the files and doing a global replace and putting in all the missing charset tags and that seems to be solving the problem.
Thanks,
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now