Solved

batch open and save

Posted on 2011-03-02
5
767 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now