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
1
vote
0 answers

UTF-16LE Encoding with BOM

I am working on a project that uses various special characters, I am working specifically on Arabic characters at the moment and I am struggling to get them to appear correctly in Excel when exporting from PHP, using my code as-is they appear as…
Mark
  • 1,852
  • 3
  • 18
  • 31
1
vote
2 answers

In Ruby, how to reliably detect a file's encoding (including UTF-16 without BOM)?

I need to detect a file type and encoding in Ruby. I'm currently using libmagic through the magic gem, but it has one problem: it doesn't detect UTF-16 files if they don't have BOM. This is an example of such file. $ file -i…
art-solopov
  • 4,289
  • 3
  • 25
  • 44
1
vote
0 answers

return a wide string from Win32::API call

I'm trying to figure out how to read the result of GetCommandLineW in Perl. I know that is should return a string beginning with " when invoked under PowerShell, but I can't seem to extract more than one character. The following snippet loads the…
Greg Nisbet
  • 6,710
  • 3
  • 25
  • 65
1
vote
1 answer

PHP: checking if string is utf-8 or utf-16le

I'm writing function that returns document in utf-8 by default, by if you provide special parameter it will return content in utf-16le. I started to write unit test for this function and what I don't understand is how to check if encoding is "utf-8"…
Tamara
  • 2,910
  • 6
  • 44
  • 73
1
vote
1 answer

Remove illegal xml characters from UTF-16LE encoded file

I have a java application that parses an xml file that was encoded in utf-16le. The xml has been erroring out while being parsed due to illegal xml characters. My solution is to read in this file into a java string, then removing the xml characters,…
Yep
  • 141
  • 1
  • 13
1
vote
1 answer

How do I save my file in UTF-16 LE encoding without BOM in VS2015?

In this link you'll find Table 1 which I reproduce below. Notice that the heading of the third column on this table specifies: UTF-16LE w/ or w/o BOM. I was able to save my file containing the snippet below, #include int main() { char…
João Afonso
  • 1,934
  • 13
  • 19
1
vote
3 answers

Swift 3: Encode String to UTF-16LE

I need to encode a string to UTF-16LE (and convert to sha1 later), but I'm having some problems. This is what I had tried: let utf16array = Array("password".utf16) print(utf16array) // [112, 97, 115, 115, 119, 111, 114, 100] But this is what I was…
hdoria
  • 624
  • 2
  • 14
  • 29
1
vote
0 answers

How to detect the proper encoding in PHP? mb_detect_encoding isn't working

I need to be able to detect a string's encoding but mb_detect_encoding isn't working. I obtain the string from a file (file_get_contents) and I know the file that was giving me trouble was in UTF-16 LE. However, from the docs what I understand is…
loco.loop
  • 1,441
  • 1
  • 15
  • 27
1
vote
1 answer

how to retrieve the attribute "unicodePwd" in Active Directory through java programming

First of all, I apology for my bad english. I'm brazilian, so if there is any mistakes at the text, please, just disconsidered. I read a lot of articles here about retrieving the attribute "unicodePwd" in Active Directory, but none of then actually…
olrossi
  • 11
  • 4
1
vote
0 answers

php UTF-16LE converted file not opening in Excel after the latest Office updates

We have a working PHP code snippets for ages. We are generates simple HTML tables and than the user can save these as an XLS file. And open it in Excel. Now when we open this kind of files Excel opens and display a totaly empty grey area. No error,…
Tamas
  • 33
  • 5
1
vote
0 answers

Convert File from UTF16 LE to UTF16 BE

There is a question from an old test that is confusing me: "When converting a file from UTF16-LE to UTF16-BE will the file be smaller or bigger afterwards?" I thought it's just a different order of the bytes, but I dont understand why it should…
Linhzy Pham
  • 53
  • 1
  • 4
1
vote
2 answers

Ruby UTF-16 encoding I think

I have a Ruby program running on Windows which calls a shell command (which is known to output UTF-16) using Open3: attrs={} attrs[:stdout], attrs[:stderr], status = Open3.capture3(command) unless attrs[:stderr].nil? begin …
Jay Godse
  • 15,163
  • 16
  • 84
  • 131
1
vote
0 answers

Do I have to remove the BOM by myself?

I'm working with UTF-16LE encoded CSV files. I use the Perl module Text::CSV_XS to handle the data: my $csv = Text::CSV_XS->new ({ binary => 1, sep_char => ';', quote_char => undef, }); open my $io, '<:encoding(UTF-16LE)', $csv_file or die…
capfan
  • 817
  • 10
  • 26
1
vote
1 answer

Convert UTF-16LE to UTF-8 in C

I am using a library which has a function that returns result strings encoded as UTF-16LE (I'm pretty sure) in a standard char *, as well as the number of bytes in the string. I would like to convert these strings to UTF-8. I tried the solution…
ibrewster
  • 3,482
  • 5
  • 42
  • 54
1
vote
1 answer

incomplete "\n" on UTF-16LE Error

I have been trying to follow several tutorials on rails and each time I am hitting the following issue at the time of running rails s: Started GET "/" for 127.0.0.1 at 2014-09-14 06:57:44 +0100 Connecting to database specified by…
Exploring
  • 2,493
  • 11
  • 56
  • 97