Todd Vakulskas

Greenhorn
+ Follow
since Jan 10, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Todd Vakulskas

I apologize it should have been 32 as you've already figured out. After reading Jesper's post regarding the byte order mark things started making sense. I added more characters to the string then realized it truly is just a header for the string and that each additional char I added only added two bytes. I want to thank everyone who contributed to this post. What a wonderful / helpful forum.

Thanks!
13 years ago
I am having some trouble understanding unicode as it relates to Java. I have wrote a test method to gain some understanding and it has confused me further.

The method that I wrote was to understand how to produce a Hex representation of a UTF16 encoded string.

Here is a excerpt from the code I wrote:



When I stop this in my eclipse debugger I get the following byte string back:
byte[4] = [-2, -1, -32, 19]


Given it's UTF16 encoding, I would have expected only two bytes back from 0x2013 (en-dash). What am I misunderstanding or what is wrong with my code ?

Any help would be appreciated
Thanks
13 years ago