This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Non printable characters  RSS feed

 
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
 
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 ]
 
Marshal
Posts: 24506
55
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"?
 
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
Marshal
Posts: 24506
55
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
 
A sonic boom would certainly ruin a giant souffle. But this tiny ad would protect it:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!