• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Non printable characters

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you give an example of your so-called "ASCII values"?
 
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic