utf-16

How to convert a utf-8 string to a utf-16 string in PHP

How do I convert a utf-8 string to a utf-16 string in PHP? ...

Writing utf16 to file in binary mode

I'm trying to write a wstring to file with ofstream in binary mode, but I think I'm doing something wrong. This is what I've tried: ofstream outFile("test.txt", std::ios::out | std::ios::binary); wstring hello = L"hello"; outFile.write((char *) hello.c_str(), hello.length() * sizeof(wchar_t)); outFile.close(); Opening test.txt in for ...

UTF-16 to UTF-8 conversion (for scripting in Windows)

Hi, what is the best way to convert a UTF-16 files to UTF-8? I need to use this in a cmd script. ...

How to convert Unicode string into a utf-8 or utf-16 string?

How to convert Unicode string into a utf-8 or utf-16 string? My VS2005 project is using Unicode char set, while sqlite in cpp provide int sqlite3_open( const char *filename, /* Database filename (UTF-8) */ sqlite3 **ppDb /* OUT: SQLite db handle */ ); int sqlite3_open16( const void *filename, /* Database filename (UT...

Any way to convert a regular string in ActionScript 3 to a ByteArray of Latin-1 Character Codes?

I am having no problem converting a string to a byteArray of UTF-16 encoded characters, but the application I am trying to communicate with (written in Erlang) only understands Latin-1 encoding. Is there any way of producing a byteArray full of Latin-1 character codes from a string within Actionscript 3? ...

What's the best way to export UTF8 data into Excel?

So we have this web app where we support UTF8 data. Hooray UTF8. And we can export the user-supplied data into CSV no problem - it's still in UTF8 at that point. The problem is when you open a typical UTF8 CSV up in Excel, it reads it as ANSII encoded text, and accordingly tries to read two-byte chars like ø and ü as two separate charact...

How did you get ASP.NET to output UTF-16 encoded text?

How did you get ASP.NET to output UTF-16 encoded text? I serialize an object in .NET which by default is UTF-16 format. Now I want to send the string as an output response to an .ashx request. I get the error: Switch from current encoding to specified encoding not supported. Error processing resource How do I tell my website or page t...

Is there a standard technique for packing binary data into a UTF-16 string?

(In .NET) I have arbitrary binary data stored in in a byte[] (an image, for example). Now, I need to store that data in a string (a "Comment" field of a legacy API). Is there a standard technique for packing this binary data into a string? By "packing" I mean that for any reasonably large and random data set, bytes.Length/2 is about t...

Difference between Big Endian and little Endian Byte order

what is the difference between Big Endian byte order and little Endian Byte order. These both are related to Unicode and UTF16 where we use this? ...

SQL Server - Grid Result Save As .CSV - How to output Text instead of UTF-16 (Unicode)

Can SQL Server Grid "Save As" be changed to write out an encoding that is Text instead of UTF-16? When I right click a Result Grid in SQL Server it allows for a Save As .CSV. Currently it saves the .CSV file encoded as UTF-16 (Unicode) but Excel does not open this format automatically (Excel prompts for a delimiter). To get around the p...

Converting xml from UTF-16 to UTF-8 using PowerShell

What's the easiest way to convert XML from UTF16 to a UTF8 encoded file? ...

Can I make git recognize a UTF-16 file as text?

I'm tracking a Virtual PC virtual machine file (*.vmc) in git, and after making a change git identified the file as binary and wouldn't diff it for me. I discovered that the file was encoded in UTF-16. Can git be taught to recognize that this file is text and handle it appropriately? I'm using git under Cygwin, with core.autocrlf set ...

Displaying Unicode characters above U+FFFF on Windows

Hi, the application I'm developing with EVC++ 4 runs on Windows CE 5 and should support unicode (AFAIK wchar_t uses UTF-16 on windows, so I'm using that), so I want to be able to test it with "more exotic" characters. Especially with characters that use 4 Byte in UTF-16 and not just 2. Therefore I'm trying to display such characters in ...

Storing UTF-16/Unicode data in SQL Server

According to this, SQL Server 2K5 uses UCS-2 internally. It can store UTF-16 data in UCS-2 (with appropriate data types, nchar etc), however if there is a supplementary character this is stored as 2 UCS-2 characters. This brings the obvious issues with the string functions, namely that what is one character is treated as 2 by SQL Serve...

Best way for Parsing ANSI and UTF-16LE files using Python 2/3?

I have a collection of files encoded in ANSI or UTF-16LE. I would like python to open the files using the correct encoding. The problem is that the ANSI files do not raise any sort of exception when encoded using UTF-16le and vice versa. Is there a straightforward way to open up the files using the correct file encoding? ...

Using PHP's SoapClient to send UTF-16 Character to WCF Service

Hello all, My PHP application is taking user input and sending it to a WCF Web Service. Sometimes my users copy and paste from Word and get UTF-16 Characters into their message such as the "En Dash" \u2013 I get the following error when this occurs. PHP Fatal error: SOAP-ERROR: Encoding: string '\xe2...' is not a valid utf-8 st...

What could go wrong in switching HTML encoding from UTF-8 to UTF-16?

What are the implications of a change from UTF-8 to UTF-16 for HTML encoding? I would like to know your thoughts on the issue. Are there things I need to think of before making such a change? Note: Interested due to enormous amounts of japanese and chinese text I need to handle. ...

How do I encode/decode UTF-16LE byte arrays with a BOM?

I need to encode/decode UTF-16 byte arrays to and from java.lang.String. The byte arrays are given to me with a Byte Order Marker (BOM), and I need to encoded byte arrays with a BOM. Also, because I'm dealing with a Microsoft client/server, I'd like to emit the encoding in little endian (along with the LE BOM) to avoid any misunderstand...

Read Unicode files C++

Hi all, I have a simple question to ask. I have a UTF 16 text file to read wich starts with FFFE. What are the C++ tools to deal with this kind of file? I just want to read it, filter some lines, and display the result. It looks simple, but I just have experience in work with plain ascci files and I'm in the hurry. I'm using VS C++, b...

Is the XML declaration tag case sensitive?

I have what is probably a really simple, studid question but I can't find an answer to it anywhere and I need to be pretty sure about this. I have various XML files from various vendors. One of the vendors provide me an XML file with japanese characters in the file. Originally, I was having trouble processing the XML file (I'm using the...