Sponsored Content
Operating Systems Linux Help to Convert file from UNIX UTF-8 to Windows UTF-16 Post 302886237 by phanidhar6039 on Thursday 30th of January 2014 08:20:52 AM
Old 01-30-2014
Help to Convert file from UNIX UTF-8 to Windows UTF-16

Hi,

I have tried to convert a UTF-8 file to windows UTF-16 format file as below from unix machine

Code:
unix2dos < testing.txt | iconv -f UTF-8 -t UTF-16 > out.txt

and i am getting some chinese characters as below which l opened the converted file on windows machine.

Code:
LANG=en_US.UTF-8
਍䰀䌀开䌀吀夀倀䔀㴀∀攀渀开唀匀⸀唀吀䘀ⴀ㠀∀ഀഀ
LC_NUMERIC="en_US.UTF-8"
਍䰀䌀开吀䤀䴀䔀㴀∀攀渀开唀匀⸀唀吀䘀ⴀ㠀∀ഀഀ
LC_COLLATE="en_US.UTF-8"
਍䰀䌀开䴀伀一䔀吀䄀刀夀㴀∀攀渀开唀匀⸀唀吀䘀ⴀ㠀∀ഀഀ
LC_MESSAGES="en_US.UTF-8"
਍䰀䌀开倀䄀倀䔀刀㴀∀攀渀开唀匀⸀唀吀䘀ⴀ㠀∀ഀഀ
LC_NAME="en_US.UTF-8"
਍䰀䌀开䄀䐀䐀刀䔀匀匀㴀∀攀渀开唀匀⸀唀吀䘀ⴀ㠀∀ഀഀ
LC_TELEPHONE="en_US.UTF-8"
਍䰀䌀开䴀䔀䄀匀唀刀䔀䴀䔀一吀㴀∀攀渀开唀匀⸀唀吀䘀ⴀ㠀∀ഀഀ
LC_IDENTIFICATION="en_US.UTF-8"
਍䰀䌀开䄀䰀䰀㴀ഀഀ

This is just a test file i was working on but the actual file contains numbers of rows and columns. Am i missing anything above up here?

The requirements are for the output should be as below

- UTF-16 Little endian
- preceded with a byte order marker --ff and fe
- Windows line endings

Any pointers will be great

Thanks,
P

Last edited by phanidhar6039; 01-30-2014 at 09:35 AM.. Reason: More info
 

10 More Discussions You Might Find Interesting

1. Programming

Howto convert Ascii -> UTF-8 & back C++

While working with russian text under FreeBSD&MySQL I need to convert a string from MySQL to the Unicode format. I've just started my way in C++ under FreeBSD , so please explain me how can I get ascii code of Char variable and also how can i get a character into variable with the specified ascii... (3 Replies)
Discussion started by: macron
3 Replies

2. UNIX for Dummies Questions & Answers

grep and UNICODE (utf-16) file

I'm using shell scripting in Applescript. When searching a file with the ANSEL character set (for GEDCOM files) using (grep '1 CHAR ANSEL' filepath) gives the expected result. When searching a UNICODE formatted file (utf-16), searching for text known to exist in the file using (grep '1 CHAR... (4 Replies)
Discussion started by: Whiterock
4 Replies

3. UNIX for Advanced & Expert Users

Convert UTF-8 encoded hex value to a character

Hi, I have a non-ascii character (Ŵ), which can be represented in UTF-8 encoding as equivalent hex value (\xC5B4). Is there a function in unix to convert this hex value back to display the charcter ? (10 Replies)
Discussion started by: sumirmehta
10 Replies

4. UNIX for Advanced & Expert Users

UTF-8 to EBCDIC conversion in UNIX

Hi all, At present a file from AS400 system is being FTPed to an AIX system. Now, a similar file needs to be sent from our Unix box (Solaris) Is there any tool available which does the conversion in Unix from UTF-8 to EBCDIC? Any suggestions/ pointers are really appreciated. Thanks,... (4 Replies)
Discussion started by: sridhar_423
4 Replies

5. Red Hat

Can't convert 7bit ASCII to UTF-8

Hello, I am trying to convert a 7bit ASCII file to UTF-8. I have used iconv before though it can't recognize it for some reason and says unknown file encoding. When I used ascii2uni package with different package, ./ascii2uni -a K -a I -a J -a X test_file > new_test_file It still... (2 Replies)
Discussion started by: rockf1bull
2 Replies

6. UNIX for Dummies Questions & Answers

Issue with UTF-8 BOM character in text file

Sometimes we recieve some excel files containing French/Japanese characters over the mail, and these files are manually transferred to the server by using SFTP (security is not a huge concern here). The data is changed to text format before transferring it using Notepad. Problem is: When saving... (4 Replies)
Discussion started by: jawsnnn
4 Replies

7. Shell Programming and Scripting

Trying to convert utf-8 to WINDOWS-1251

Hello all i have utf-8 file that i try to convert to WINDOWS-1251 on linux without any success the file name is utf-8 when i try to do : file -bi test.txt it gives me : text/plain; charset=utf-8 when i try to convert the file i do : /usr/bin/iconv -f UTF-8 -t WINDOWS-1251 test.txt >... (1 Reply)
Discussion started by: umen
1 Replies

8. Shell Programming and Scripting

Copying a file with UTF char on UNIX server

Hi, I need to run a SQL which check for special UTF char in DB. When I try to copy that in UNIX file it changes it to some wierd chat. How can in retain the UTF chars in my script? e.g. ο|π|ρ|σ|τ|υ|φ|χ|ψ Any help will be appriciated. Thanks, (14 Replies)
Discussion started by: varun22486
14 Replies

9. Shell Programming and Scripting

Convert UTF-8 file to ASCII/ISO8859-1 OR replace characters

I am trying to develop a script which will work on a source UTF-8 file and perform one or more of the following It will accept the target encoding as an argument e.g. US-ASCII or ISO-8859-1, etc 1. It should replace all occurrences of characters outside target character set by " " (space) or... (3 Replies)
Discussion started by: hemkiran.s
3 Replies

10. UNIX for Beginners Questions & Answers

Convert files to UTF-8 on AIX 7.1

Dears, I have a shell script - working perfectly on Oracle Linux - that detects the encoding (the charset to be exact) of the files in a specified directory using the "file" command (The file command outputs the charset in Linux, but doesn't do that in AIX), then if the file isn't a UTF-8 text... (4 Replies)
Discussion started by: JeanM-1
4 Replies
MKCOMPOSECACHE(1)					      General Commands Manual						 MKCOMPOSECACHE(1)

NAME
mkcomposecache - create a cache file for a compose file explicitely SYNOPSIS
mkcomposecache locale compose-file cache-dir [ internal-name ] DESCRIPTION
mkcomposecache creates a cache file for the specified compose-file used in the given locale and saves it in cache-dir. If internal-name has been spezified, it is used as the name of the compose table for computing the hash values and internal validation. This is necessary if global compose cache files shall be created while using DESTDIR during X11 installation. Notes: - compose cache files are created by libX11, thus an Xserver has to be running and DISPLAY has to be set correctly for creating cache files. - libX11 will not write compose cache files if run as root or with different real and effective uids. - libX11 will not create compose cache files in directories writable for other users. DIAGNOSTICS
mkcomposecache returns with exit status 1 on general errors (no Xserver, invoked as root, etc.) and 2 on unsupported locales. An exit status of 0 does not imply that a cache file is actually written, though. This very much depends on the used libX11 and its safety regulations. EXAMPLES
mkcomposecache en_US.UTF-8 /var/tmp/buildroot/usr/share/X11/locale/en_US.UTF-8/Compose /var/tmp/buildroot/var/X11R6/compose_cache /usr/share/X11/locale/en_US.UTF-8/Compose FILES
/var/X11R6/compose_cache Location of global compose cache. AUTHOR
mkcomposecache was written by Matthias Hopf <mhopf@suse.de>. X Version 11 mkcomposecache 1.0 MKCOMPOSECACHE(1)
All times are GMT -4. The time now is 07:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy