Forum Moderators: phranque

Message Too Old, No Replies

convert to utf-8 using gnuwin32

         

helenp

7:36 am on Aug 4, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi,
I have downloaded libiconv-1.9.2-1.exe and I want to convert to utf-8 from iso-8859-1
there are only html and pdf files, so I suppose should write cmd and then write the command line.
However I dont understand anything, if anybody know the command to write convert .htm, .php, .js and .css files in a file from iso-8859-1 to utf-8 I would apreciate it.
Have been searching in google but cant find any tutorial.
Thanks in advance

phranque

12:48 pm on Aug 4, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



there's an example on the ICONV man page:
http://www.gnu.org/s/libiconv/documentation/libiconv/iconv.1.html [gnu.org]

helenp

12:52 pm on Aug 4, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks pranque,
however I dont understand anything....not used to use commands.

This is the example I see:
iconv &#8722;f KOI8&#8722;R &#8722;&#8722;byte&#8722;subst="<0x%x>"
&#8722;&#8722;unicode&#8722;subst="<U+%04X>"
Its chinese to me, cant see any folder or files in it.
Anybody that done this on window before?

helenp

3:38 pm on Aug 4, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Sorry, that was the russian examepel:
lol, the characters came wrong,
this is the correct exampel,
I added a file at the end:
iconv -f ISO&#8722;8859&#8722;1 &#8722;t UTF&#8722;8 /Nueva carpeta (2)/index.htm

But doing whatever I do, I get iconv is not a recognized internal or external command ¿more or less translated from spanish.

Edited, the name of caracters dont work, put them in code, but still the same

Leosghost

3:49 pm on Aug 4, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



@helenp ..try this
[unicodetools.com ]

It opens in the latin to utf8 converter version ( which is the one you want ) ..just paste what you want converting in the box ..and click convert :)

It is free ..and I have no connection with it all ..we had another thread about converting a while back here ..I mentioned it then too.

helenp

4:00 pm on Aug 4, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Dear Leosghost, thanks however its a web with 500 pages, where searching for a way not to do it one by one.

helenp

5:18 pm on Aug 4, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



My son has linux, I could try there, as it does not seem to work on my windows.
However is there a way to convert a folder?
not doing the file, file per file?
Cant find any command for that.
Thanks

helenp

7:22 pm on Aug 4, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just tried the online tool, and did not do the whole page...
Just found out that if I put default files to utf-8 then open the files in dreamweaver, having the files open, then using find and replace changing the character set, and then dont click save all and close all (If I do so, it is saved as iso I think), instead click on save as and save with same name manually, then its saved as utf-8 and then close it, seems to work as when I open the files I converted that way pspad says they are utf-8 also w3c says they are utf-8 encoding (normal check not mobile)

Leosghost

7:43 pm on Aug 4, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just tried the online tool, and did not do the whole page

No doubt it depends on the size of the page in kb..or chars are limited in the "input" field.

But as you have done it in DW you are good to go if w3c says "OK"..

SteveWh

7:58 pm on Aug 4, 2011 (gmt 0)

10+ Year Member



If your son uses linux, your easiest solution is probably to ask him to do this for you. He will be familiar with running programs from the command line, and how to process all the files in one or more folders.

In Windows, this is the important error message:

iconv is not a recognized internal or external command


It is a File Not Found error.

Windows is searching for a program called iconv.exe so it can launch and run it, but it is failing to find that file. If that's the correct name, then the file must not be in one of the folders that Windows automatically searches to find program files.

The solution is to find the file yourself (on my Windows XP computer, it would be in C:\Program Files\GnuWin32\bin), and then either add that path to your "system path", or specify the full path to the file when you type your iconv command line.

In other words, your Windows problems so far have nothing to do with the capabilities of iconv, but with the fact that Windows can't find the program. The program is not being run.

helenp

8:28 pm on Aug 4, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Dear Steve,
I see you understand, it is just as you said, however I still dont know how to do the command,
as far as I can see you have to do the files one by one?
Is that so?, or can you convert a folder?
If not, I think the dreamweaver way looks easier.

My son could do, however he dont have those program installed, and dont have much time.

SteveWh

9:16 pm on Aug 4, 2011 (gmt 0)

10+ Year Member



After reading the documentation, I think you are correct that it will only do one file at a time. (If you process multiple files at once, it can do that, but all the output will go into one big file, and that's not what you want.)

If you found a way (Dreamweaver) that will work and that you understand well, it is probably best to use that method instead.

helenp

9:48 pm on Aug 4, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



yes it works,
however the problem is the inludes (php files)
they dont have any meta, headers or anything at all, just the text, and its imposible to save as utf-8 in dreamweaver,
uploaded a file and w3c could not check it as it was something wrong with the utf-8
so 2 includes opened in pspad and changed there to utf-8, when opened with dreamweaver was utf-8 and I could validate the url with w3c, really complicated,
dont understand there arent no easy way, there must be millions of old sites with thousands of pages out there in iso.

SteveWh

2:04 am on Aug 5, 2011 (gmt 0)

10+ Year Member



Maybe try the free Notepad++ editor.

It will still only do 1 file at a time, but the conversion is easy. It has an "Encoding" menu item. Choose the encoding you want, and save the file.

helenp

8:17 am on Aug 5, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks, I used pspad for it, buy maybe notepad++ is better.