In my Linux env, for some unknown! reason when I process a raw unformatted file which I copied from Win7prof (was encoded in utf-16), the resulting file is all jumbled. It will print OK in Linux using cat command,
but if I vi, its also jumbled like this:
Username;Full Name;Groupsï¼å¾çæçæ¸ææ´æã¬äçæ°æ°âä¸ææ´æã¬ççæçççà¨æâ¸ææ´æ¤çâ¸çæçæççæçäæ¼çâ¸çæçæççæçäæ¼çæææ°æâ¸ææ¼æ´ã¬ääåå¼ççæççà¨æâ¸ææ´æ¤çâ¸çæçæççæçäæ¼çæææçäæ¼çæææ°æâ¸ææ¼æ´ã¬æ¨æ¤çæâ´ççæççà¨ã¬^@æææ´æ¤çâ¸æææ¤æäæ¼çæææ°æâ¸ææ¼æ´ã¬äææ´æ¤çææ´æ¤çâ¸æææ¤æäæ¼çæææ°æâ¸ææ¼æ´ã¬æ¨æ¤çæâ´ççæççà¨ã¬^@ææçæ¼æ¸â¸ææ°æçææ æçäæ¼çæææçææ æçäæ¼çæææ°æâ¸ææ¼æ´à¨ã¬^@ææçæ¼æ¸â¸ææ°æçææ æçäæ¼çæææ°æâ¸ææ¼æ´ã¬æ¨æ¤çæâ´ççæ¼æ´ã¬ä¸äå¼ççæççà¨ã¬^@ææçæ¼æ¸â¸æ
the same file when moved to Windows, opens up with first few words in English, then the rest of the file prints in Chinese characters!
looks like:
Username;Full Name;Groups*嗾猀攀爀渀愀洀攀㬀䘀甀氀氀 一愀洀攀㬀猀琀愀琀甀猀愀⸀愀洀椀琀⸀猀愀爀愀猀眀愀琀䀀漀爀愀挀氀攀⸀挀漀洀㬀䄀 匀愀爀愀猀眀愀琀愀⸀愀洀椀琀⸀猀愀爀愀猀眀愀琀䀀漀爀愀挀氀攀⸀挀漀洀㬀䔀䄀匀开甀猀攀爀猀愀⸀愀洀椀琀⸀猀愀爀
When I check the char-set of the file, it returns:
application/octet-stream
and I can't run iconv command because it rejects octet-stream
as a character set!
The only sure thing I know is that file formats between my linux and Windows have been compatible all along, I've modified files on linux, ftp back to windows for ever without any issues until now with this command:
[me@localhost fkhodada]# awk -F';' -v OFS=';' '{ for (i=3; i<=NF; i++) print $1,$2,$i }
' file1 > final
locale(1)
on the linux box is correct.hd file
orxxd -g1 file
orod -tx1c file
. ------ 4. What you wrote: "the same file when moved to Windows, opens up with first few words in English, then the rest of the file prints in Chinese characters!" strongly suggests that the file content is corrupted. Why do not you consider this possibility?