utf-16le

What to include when using Encode with PAR Packer

有些话、适合烂在心里 提交于 2021-02-10 13:56:30
问题 I've been working with PAR::Packer to create standalone executable files out of Perl scripts. The only difficulty I have with it is figuring out what extra DLLs I have to force it to include via the -l option. I'm now working with a Perl script that requires Encoding with utf16-le. The Encode::find_encoding function works just fine in the script, but it doesn't work after I have packaged it with pp . Here's a tiny script (let's call it encode.pl) to illustrate the problem: use strict; use

notepad ++ shows ucs-2LE while ubuntu FILE [file] shows UTF-16LE, I am confused?

☆樱花仙子☆ 提交于 2020-01-04 04:08:10
问题 I am trying to convert the file generated from a mssql to utf-8. When I open the output of he mssql using notepad++ in windows server 2003 recognises the file as UCS-2LE I copied the file to a Ubuntu machine, using file [file] it shows that the encoding is UTF-16LE . Really confused, there must be some difference in encoding, as the names are different. But why do I see this in the same file. Its a .csv file generated from the mssql query. 回答1: For the most part, UTF-16 and UCS-2 are the same

OSX perl to batch write filename as first line in txt file in UTF-16LE

那年仲夏 提交于 2019-12-24 03:24:07
问题 I found a really useful bit of perl here that writes the filename of a text file to the first line of the file. I am running this from terminal in OS X Yosemite: perl -i -pe 'BEGIN{undef $/;} s/^/\nFilename:$ARGV\n/' `find . -name '*.TXT'` With some modification I thought it had solved my specific problem however the files I'm picking up are UTF-16LE and I've since discovered this command is writing in UTF-8 and making a real mess of the output (text is visibly correct but is not recognised

How to use Ruby's readlines.grep for UTF-16 files?

北城以北 提交于 2019-12-18 09:24:58
问题 Given the following two files created by the following commands: $ printf "foo\nbar\nbaz\n" | iconv -t UTF-8 > utf-8.txt $ printf "foo\nbar\nbaz\n" | iconv -t UTF-16 > utf-16.txt $ file utf-8.txt utf-16.txt utf-8.txt: ASCII text utf-16.txt: Little-endian UTF-16 Unicode text I'd like to find the matching pattern in UTF-16 formatted file, the same way as in UTF-8 using Ruby. Here is the working example for UTF-8 file: $ ruby -e 'puts File.open("utf-8.txt").readlines.grep(/foo/)' foo However, it

Fast method to read csv with UTF-16LE encoding

泄露秘密 提交于 2019-12-12 12:27:17
问题 I'm dealing with .csv files with UTF-16LE encoding, this method works to read the files, but read.csv is very slow compared to read_csv. read.csv2(path,dec=",",skip=1,header=T,fileEncoding="UTF-16LE",sep="/t") Unfortunately I can't make read_csv work, I only get empty rows and I don't find a way to even specify encoding in the function. I can't share my data, but if anyone dealt with this encoding any help would be appreciated. 回答1: You can specify file encodings with readr functions like

Ruby: how to save file to UTF-16 Little Endian

守給你的承諾、 提交于 2019-12-10 19:23:00
问题 I want to save ® into a txt file with UTF-16 Little Endian, I tested in some ways 1.The encoding below is UTF-8 $RegisterMark=[174].pack('U*') file = File.new("C:/Output.txt","w") file.puts $RegisterMark file.close 2.The encoding below is UTF-16 Big Endian require 'iconv' $RegisterMark=[174].pack('U*') $utf16RegisterMark =Iconv.conv('UTF-16', 'UTF-8', $RegisterMark ) file = File.new("C:/Output.txt","w") file.puts $utf16RegisterMark file.close The mentod Iconv.conv doesn't suport UTF-16 LE

Python - read text file with weird utf-16 format

一个人想着一个人 提交于 2019-12-08 19:25:01
问题 I'm trying to read a text file into python, but it seems to use some very strange encoding. I try the usual: file = open('data.txt','r') lines = file.readlines() for line in lines[0:1]: print line, print line.split() Output: 0.0200197 1.97691e-005 ['0\x00.\x000\x002\x000\x000\x001\x009\x007\x00', '\x001\x00.\x009\x007\x006\x009\x001\x00e\x00-\x000\x000\x005\x00'] Printing the line works fine, but after I try to split the line so that I can convert it into a float, it looks crazy. Of course,

Using iconv to convert from UTF-16LE to UTF-8

社会主义新天地 提交于 2019-12-03 04:30:31
问题 Hi I am trying to convert some log files from a Microsoft SQL server, but the files are encoded using UTf-16LE and iconv does not seem to be able to convert them. I am doing: iconv -f UTF-16LE -t UTF-8 <filename> I also tried to delete any carriage returns from the end of the line if there are any, but that did not fix it either. If I save it using gedit that works, but this is not a viable solution since I have hundreds of those files. EDIT : Please see the new answer for the missing option