Questions tagged [utf-16le]

UTF-16LE is the little endian variety of UTF-16 without BOM.

UTF-16LE is the little endian variant of . While text in UTF-16 might be expected to signal endianness by starting with a Byte-Order-Mark, text in UTF-16LE should not. UTF-16LE can encode all code points in two or four bytes, like UTF-16.

UTF-16LE is the encoding used for the API, and many frameworks there. Most stored text on Windows is actually instead . Text in both formats on Windows often start with a BOM, which can confuse software not expecting it.

For any more details, consider instead.

82 questions
69
votes
2 answers

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

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 I also tried to delete any…
laitha0
  • 4,148
  • 11
  • 33
  • 49
19
votes
4 answers

Python - read text file with weird utf-16 format

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 …
DanHickstein
  • 6,588
  • 13
  • 54
  • 90
8
votes
4 answers

UnicodeDecodeError: 'utf-16-le'

I'm trying to pull a list of tables from an access database. The script goes through and displays about a third of the tables and gets the following error: Traceback (most recent call last): File "C:/GageInfo/sourcecode for …
Eddie Snipes
  • 119
  • 1
  • 1
  • 8
5
votes
2 answers

Converting a UTF-16LE Elixir bitstring into an Elixir String

Given an Elixir bitstring encoded in UTF-16LE: <<68, 0, 101, 0, 118, 0, 97, 0, 115, 0, 116, 0, 97, 0, 116, 0, 111, 0, 114, 0, 0, 0>> how can I get this converted into a readable Elixir String (it spells out "Devastator")? The closest I've gotten is…
user701847
  • 337
  • 3
  • 15
5
votes
1 answer

Fast method to read csv with UTF-16LE encoding

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…
Sebastian
  • 2,430
  • 4
  • 23
  • 40
5
votes
1 answer

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

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…
tough
  • 301
  • 1
  • 7
  • 14
4
votes
1 answer

read into R data frame from cognos 8 file (utf 16) with readr

I am attempting to read csv files generated by cognos 8 into r using readr. Example file attached for reproducibility: Example csv file The following python code works: df = pd.read_table('csv_test.csv', encoding = 'utf-16') I've tried the…
d.ellis
  • 61
  • 6
4
votes
0 answers

Visual Studio 2015 _references.js UTF-16LE

In my installation of Visual Studio (Microsoft Visual Studio Community 2015), for MVC projecs, the _references.js file's character encoding is of type UTF-16LE, which prevents Git from recognizing textual differences when a change is made, treating…
4
votes
2 answers

how to check in perl if a file is written as little endian or big endian?

Actually i have to parse some files which can be in any form of endian (Big or Little). Perl interpreter dies if I use one encoding and parse other. open (my $fh, "<:raw:encoding(UTF-16LE):crlf", $ARGV[0]) or die cannot open file for reading : $!…
Pradeep
  • 109
  • 5
3
votes
1 answer

PHP cannot parse CSV correctly (file is in UTF-16LE)

I am trying to parse a CSV file using PHP. The file uses commas as delimiter and double quotes for fields containing comma(s), as: foo,"bar, baz",foo2 The issue I am facing is that I get fields containing comma(s) separated. I get: "2 rue du…
AymDev
  • 6,626
  • 4
  • 29
  • 52
3
votes
2 answers

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

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…
jsjwql
  • 31
  • 2
  • 4
3
votes
1 answer

How do I work with UTF-16LE source code in Ruby?

I have the following file named test.rb encoding in UTF-16LE # encoding: UTF-16LE test = "test!" p test Running it with the following command produces no results ruby ./test.rb What am I missing here? In case anyone is wondering, the reason I'm…
kubi
  • 48,104
  • 19
  • 94
  • 118
3
votes
1 answer

UTF16-LE with BOM not recognizing sep in csv file

I need to generate a csv through PHP in UTF16-LE to support Excel (on Windows and Mac OS X). As suggested here I used mb_convert_encoding and added the BOM at the file start, followed by sep=; in order to make it open properly on…
vard
  • 4,057
  • 2
  • 26
  • 46
3
votes
2 answers

How can I read from files in UTF-16LE encoding in PHP?

I've got CSV files in UTF-16LE encoding with a BOM. They might be pretty big, so I don't really like the idea of reading whole files in memory. How do I go about reading them?
x-yuri
  • 16,722
  • 15
  • 114
  • 161
2
votes
2 answers

How do i encode powershell script to base64 UTF16-LE string using C#

I want to encode a powershell script from string, but I can't get it to be encoded in UTF16-LE. I am using this to encode it to base64 string. string encodedscript = "powershell -nop -enc " +…
1
2 3 4 5 6