Solved

batch open and save

Posted on 2011-03-02
5
774 Views
Last Modified: 2012-08-13
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
Comment
Question by:avir
  • 3
  • 2
5 Comments
 
LVL 5

Expert Comment

by:h4mi
ID: 35024853
0
 

Author Comment

by:avir
ID: 35024906
Looks promising. I'll give it a try.
0
 

Author Comment

by:avir
ID: 35024980
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
 
LVL 5

Accepted Solution

by:
h4mi earned 100 total points
ID: 35025727
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
 

Author Closing Comment

by:avir
ID: 35026316
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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
CSS Style Effect 2 18
Clear input text 15 26
I really need help in my css for such a simple change, but can't find the code to do it 13 51
NTP time source for DC 3 41
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question