CONVERTCP.exe - Convert text from one code page to another

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
miskox
Posts: 329
Joined: 28 Jun 2010 03:46

Re: CONVERTCP.exe - Convert text from one code page to another

#76 Post by miskox » 22 Mar 2019 02:42

What was at first a 'simple' problem for me (converting .txt files between CP852 and CP1250 -see viewtopic.php?p=50289#p50289) is now an ongoing project.

Steffen once wrote
I don't expect to get bug reports because the utility will not be found and used that often.
How many times this thread has been read: 27,000 times!

Also
dated 06 Dec 2016 14:05
Then I'll leave it as it is unless somebody finds a bug or has a request to add another feature ...
and
dated 02 Feb 2017 20:21 (version 1.4.3)
I'll archive it and leave it alone
And now we are at version 6.1!

Steffen: thanks again.

Saso

aGerman
Expert
Posts: 3558
Joined: 22 Jan 2010 18:01
Location: Germany

Re: CONVERTCP.exe - Convert text from one code page to another

#77 Post by aGerman » 22 Mar 2019 10:44

Yes, and now I have to grapple all the time to keep the thing up to date and running. You're the culprit, Saso :evil: (just kidding :lol:)
Seriously, when I started developing this utility I didn't expect that there is no end in sight. But meanwhile it's something like my baby. And still it's fun to work on it, and still I learn something new every time. And as long as a few people have a use for it, it's motivation enough to continue. Curiously there is no on-board tool for Windows like iconv for *nixoid systems.
So, thank you for having the idea :)

Steffen

Squashman
Expert
Posts: 4093
Joined: 23 Dec 2011 13:59

Re: CONVERTCP.exe - Convert text from one code page to another

#78 Post by Squashman » 23 Mar 2019 07:59

aGerman wrote:
22 Mar 2019 10:44
Curiously there is no on-board tool for Windows like iconv for *nixoid systems.
I wonder if it comes with the Linux subsytem for Windows 10? I have yet to install and try it.

aGerman
Expert
Posts: 3558
Joined: 22 Jan 2010 18:01
Location: Germany

Re: CONVERTCP.exe - Convert text from one code page to another

#79 Post by aGerman » 23 Mar 2019 09:57

Squashman wrote:
23 Mar 2019 07:59
I wonder if it comes with the Linux subsytem for Windows 10?
Yes, of course. But the WSL isn't available for Win10 x86, and since iconv (along with the other Linux tools) is a native ELF file, you can't just execute it from the Windows command line. You always need the Linux shell of your installed distribution involved.

Steffen

penpen
Expert
Posts: 1662
Joined: 23 Jun 2013 06:15
Location: Germany

Re: CONVERTCP.exe - Convert text from one code page to another

#80 Post by penpen » 23 Mar 2019 10:53

To be honest, i never needed such a tool:
Most of the time it was sufficient to be able to convert from utf-16le to all installed codepages.
(So i never tried to convert from codepage to utf-16le, so i never checked if that was possible.)

utf-8le -> any installed codepage:

Code: Select all

@echo off
:: needed files:
:: "bom.utf-16le.txt" contains 2 boms, nothing else
:: "test.utf-16le.txt" contains any text must have a utf-16le bom

:: with or without a bom
chcp 65001
>"test.utf-8.bom.txt" type "bom.utf-16le.txt" "test.utf-16le.txt"
>"test.utf-8.txt" type "test.utf-16le.txt"

chcp 65000
>"test.utf-7.txt" type "test.utf-16le.txt"

chcp 850
>"test.cp850.txt" type "test.utf-16le.txt"

penpen

aGerman
Expert
Posts: 3558
Joined: 22 Jan 2010 18:01
Location: Germany

Re: CONVERTCP.exe - Convert text from one code page to another

#81 Post by aGerman » 23 Mar 2019 12:39

In post #3 I already addressed this possibility, penpen. Also ADO streams as used in Dave's JREPL.BAT are good alternatives to convert the text encoding. I'm absolutely of your opinion that you don't need any 3rd party whenever you can use the possibilities that the operating system already provides.
(So i never tried to convert from codepage to utf-16le, so i never checked if that was possible.)
Think of CMD /u /c.

It's rather the multi-threaded processing in CONVERTCP that makes it quite usefull if you have to convert big files. Furthermore you can convert UTF-16 BE and UTF-32 LE/BE where the combination of CHCP and TYPE isn't applicable anymore. And TYPE still causes problems using UTF-8 because character boundaries are not respected.

Steffen

Post Reply