FAQ Database Discussion Community


Excel not displaying unicode characters

excel,vba,excel-vba,unicode,utf-16
I've tried to print the Unicode characters (UTF-16) using the following code: Sub PrintUnicode() For Each Cell In Range("A1:J6553") '2^16/10: displays 10 chars in each line Cell.Value = ChrW(i) i = i + 1 Next End Sub Sample output: So the actual character id if you will is: 10*(RowNumber-1) +...

Python decoding UTF-16 from output of struct.unpack()

python,python-2.7,utf-16
I can't figure out where I went wrong on this. Here's the piece of data I'm trying to decode. ('2','\x00','2','\x00','5','\x00','0','\x00', 'P','\x00','i','\x00','n','\x00','O','\x00','V','\x00', 'E','\x00','m','\x00','p','\x00','t','\x00','y','\x00') Here's the piece of code: s = bytes(struct.unpack('28c',fld_desc)).decode('utf-16') Instead of getting the string '2250PinOVEmpty', I got this... very strange string of symbols:...

VB & Chinese string

unicode,vb6,utf-16
I am trying to capture a Chinese text from a website using VB6 simple code used to do this as below, working good with the English sites Private Function RequestText(sURL, Optional sMethod = "POST") 'You may have caching issues using GET Dim XMLHTTP Set XMLHTTP = CreateObject("microsoft.XMLHTTP") sMethod = UCase(sMethod)...

how to convert a string to UTF-16

java,utf-16
how to convert a string to UTF-16 in java ? i am converting the below objc code to java , but the java code does not give me same result as this code NSData *inputData = [pm dataUsingEncoding:NSUTF16LittleEndianStringEncoding]; NSString *encodedString = [inputData base64EncodedString]; pm = [IFunctions replaceString:encodedString replaceChar:@"=" replaceWithChar:@"-"]; Java...

Change XML encoding in LabVIEW

xml,utf-16,labview
I'm trying to edit an xml file in labVIEW for use by a .NET assembly later on in the program, however, when labview saves the file it changes the encoding. This prevents the .NET assembly from being able to open the file, since it needs to be in UTF-16 or...

Display unicode characters (emojies) in Javascript

javascript,unicode,utf-8,utf-16
I have a database with tweets such as "\U0001f374 Lunch. Had loads of meat..." -- that is, with emojies represented as unicode (\U0001f374 is the knife&fork emoji). In my Web app I fetch tweets using Ajax requests and want to display them. No big deal, and I have it so...

MD5 value mismatch between SQL server and PostgreSQL

sql-server,postgresql,unicode,utf-8,utf-16
In order to write some code to do consistency check of data stored in both SQL server and PostgreSQL, I plan to calculate the MD5 on table data for both the databases, and verify if they are equal. This works fine as long as data is plain text ( ANSI...

Convert byte array from utf-16 to utf-8

c++,utf-8,utf-16
I have a byte array uint8_t array[] = {0x00, 0x72, 0x00, 0x6f, 0x00, 0x6f, 0x00, 0x74}; I know, that in text this is "root"; I have a function that should convert utf-16 to utf-8. Here is the code: inline bool convertUcs2ToUtf8(const std::vector<char> &from, std::string* const to) { return ucnvConvert("UTF-16", "UTF-8",...

C#: how to get first character of a string?

c#,string,unicode,utf-16,surrogate-pairs
We already have a question about getting the first 16-bit char of a string. This includes the question code: MyString.ToCharArray[0] and accepted answer code: MyString[0] I guess there are some uses for that, but when the string contains text we hopefully are all aware that a single 16-bit char cannot...

Covert UTF-16 Character Code (number) to String in Java

java,utf-16
How do I simply convert a UTF-16 character to String? something Like String str = TheMagicalFunction(0x25E6); ...

How does Apache commons IO convert my XML header from UTF-8 to UTF-16?

java,utf-8,apache-commons,utf-16,document-conversion
I’m using Java 6. I have an XML template, which begins like so <?xml version="1.0" encoding="UTF-8"?> However, I notice when I parse and output it with the following code (using Apache Commons-io 2.4) … Document doc = null; InputStream in = this.getClass().getClassLoader().getResourceAsStream(“my-template.xml”); try { byte[] data = org.apache.commons.io.IOUtils.toByteArray( in );...

C++ Reading UTF8 buffer using wide stream

c++,utf-8,inputstream,utf-16
My problem is that I have a buffer in utf8 format stored in a std::string. I want to supply it as a wistringstream to boost spirit. How can I do it without converting the whole std::string to std::wstring. I would like to have a stream that works as a readonly...

Can UTF-8 hold the same data that UTF-16 can hold

java,encoding,utf-8,character-encoding,utf-16
Using Java I'm persisting multilingual text to a file in a UTF-16 format. To save disk space I want to switch to use UTF-8. Can UTF-8 express the same range of character sets that UTF-16 can? This will allow me to avoid regression or extensive testing in different human languages....

dos2unix: Binary symbol 0x04 found at line 1703

utf-16,byte-order-mark,dos2unix
I download a file from the OECD http://stats.oecd.org/Index.aspx?datasetcode=CRS1 ('CRS 2013 data.txt') by selecting Export-> Related files. I want to work with this file in Ubuntu (14.04 LTS). When I run: dos2unix CRS\ 2013\ data.txt I see: dos2unix: Binary symbol 0x0004 found at line 1703 dos2unix: Skipping binary file CRS 2013...

Express JS 4.0, serve binary data, request Accept header changes output

javascript,node.js,express,base64,utf-16
Thanks in advance. Short: Express JS 4.0 alters the output data, due to the Accept headers in the request. Is there a way for me to override this behaviour, and just write the same data regardless of the request headers. When Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 is present output is changed. Is there...

How do I compare each character of a String while accounting for characters with length > 1?

java,string,unicode,character-encoding,utf-16
I have a variable string that might contain any unicode character. One of these unicode characters is the han 𩸽. The thing is that this "han" character has "𩸽".length() == 2 but is written in the string as a single character. Considering the code below, how would I iterate over...