Java unicode

hello, I have the following code in c that I need to convert to java.
i'm just struggling converting \x001 to java.  appreciate any help. thanks

unsigned char myStr[] = {
'4', '3', '|',
'1', '|',
'2', '3', '2',  '0', '5', '3', '4', '9', '|',
'|',
'\x0f5', '\x000',
'\x001', '\x000', '4', '\x000',
'\x002', '\x000', 'R', 'i', 'c', 'k', '\x000',
'\x003', '\x000', 'H', 'i', ' ', 't', 'h', 'e', 'r', 'e', '!', '\x000',
'|'
};


appreciate any help.
h3razaAsked:
Who is Participating?
 
mccarlIT Business Systems Analyst / Software DeveloperCommented:
Try something more like this...

byte myStr[] = {
'4', '3', '|',
'1', '|',
'2', '3', '2',  '0', '5', '3', '4', '9', '|',
'|',
(byte) 0xf5, 0x00,
0x01, 0x00, '4', 0x00,
0x02, 0x00, 'R', 'i', 'c', 'k', 0x00,
0x03, 0x00, 'H', 'i', ' ', 't', 'h', 'e', 'r', 'e', '!', 0x00,
'|'
};
0
 
Kenneth BrownResearch AssociateCommented:
Im not a java expert, but see if this helps: http://mindprod.com/jgloss/hex.html
0
 
h3razaAuthor Commented:
yes, i've looked at that but not sure how to do 'x001' in java.
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
wdfdo1986Commented:
try this line and see
System.Out.println('\u0D9A');
0
 
h3razaAuthor Commented:
but I want to send it  over a socket connection
0
 
h3razaAuthor Commented:
what is the difference in putting the \x and \u   c, java?
0
 
wdfdo1986Commented:
in java if we say \u for a character that means that character is a unicode character
i dont know much about c but
0
 
h3razaAuthor Commented:
the only question is how to convert the following to java. I tried adding u instead of x but eclipse complains saying there is no such unicode

'\x0f5', '\x000',
'\x001', '\x000', '4', '\x000',
'\x002', '\x000', 'R', 'i', 'c', 'k', '\x000',
'\x003', '\x000', 'H', 'i', ' ', 't', 'h', 'e', 'r', 'e', '!', '\x000',
0
 
wdfdo1986Commented:
try adding \u instead of \
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.