Solved

batch open and save

Posted on 2011-03-02
5
776 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
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…

734 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