Converted SRC file from ANSI to UTF-8 through a batch script, but some Latin characters sets are getting loaded with some other Latin characters. PLEASE HELP

Jasmine Sandlas
Jasmine Sandlas used Ask the Experts™
on
Converted SRC file from ANSI to UTF-8 through a batch script, but some Latin characters sets are getting loaded with some other Latin characters. Experts PLEASE HELP

Example:-
ANSI file :- Srihas Rüpock
UTF-8 File :- Srihas Rⁿpock

Command Using to convert ANSI file to UTF file through command prompt is:-

powershell -ExecutionPolicy Bypass -NoLogo -NoProfile -Command "Get-Content 'srcfile.txt' -Encoding Oem | Out-File 'tgtfile.txt' -Encoding UTF8"
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Developer
Commented:
Without testing: The problem is that you specify the source encoding. This may be the wrong one. Let Get-Content handle the source encoding. Remove the -Encoding Oem clause from Get-Content.

E.g. something like

PowerShell -Command "Get-Content 'IN_FILE_NAME' | Set-Content -Encoding UTF8 'OUT_FILE_NAME'"

Open in new window

Author

Commented:
that actually worked well. thanks!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial