• Post Reply Bookmark Topic Watch Topic
  • New Topic

Non printable characters  RSS feed

 
Naresh Rajan
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am migrating a code from VB to JAVA. In which am processing a string which contains some non printable characters. The ASCII value for some of these is differnt from the int value of that in JAVA. Please advise me what to do in this case. I dont even know whether this can be done at all. Please help
 
M Anderson
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe process the string as an array of bytes instead -- and use the java.io classes to do whatever it is you need to do? Do you need to display this data (if so, why is it non-printable).

Can you give an example of the data you're using? What sort of processing are you doing?
[ April 14, 2006: Message edited by: M Anderson ]
 
Paul Clapham
Sheriff
Posts: 22844
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you give an example of your so-called "ASCII values"?
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is strange because the ASCII values correspond to same characters in Java.

Remember however that Java supports Unicode and that some characters may look the same although they are completely different Unicode values.
 
Paul Clapham
Sheriff
Posts: 22844
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Edwin Dalorzo:
That is strange because the ASCII values correspond to same characters in Java.
However it's quite common for people familiar with VB to not realize that ASCII officially only encodes positions 0 to 127. Often they don't realize that what they have been calling "ASCII" is one of several dozen "extended ASCII" encodings which encode positions 128 to 255 in many different ways that usually do not correspond with Unicode.
[ April 14, 2006: Message edited by: Paul Clapham ]
 
Naresh Rajan
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the code i am trying to migrate was written in VB a few years back and it is very VB specific. It reads a jpg file like a txt file and converts the data into hex and stores in the database. The charecters are taken in a byte array and converted to hex array. in vb always the hex string is always of 2 chars length.(i dunno why). but if i do the same in java it is sometimes 16 chars long. i am totally clueless.Please help
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!