| Author |
identify and replace special character
|
tormod eriksen
Ranch Hand
Joined: Jan 23, 2002
Posts: 52
|
|
I am to replace a specific set of characters in a textfile with another specific set of characters. I stumble upon two problematic characters. In my textfile reader they show as a general character (it can't show it), but in HEX mode one is represented by 9D and the ohter by 8F. When I read in the string in java, and try s = s.replace('\u009D', '<character of choice>'), the character isn't replaced. When I output the string the 9D and 8F characters show as ? (a question mark) Any ideas how I can replace these characters would by highly appreciated!
|
 |
Jon Dornback
Ranch Hand
Joined: Apr 24, 2002
Posts: 137
|
|
Originally posted by tormod eriksen: I am to replace a specific set of characters in a textfile with another specific set of characters. I stumble upon two problematic characters. In my textfile reader they show as a general character (it can't show it), but in HEX mode one is represented by 9D and the ohter by 8F. When I read in the string in java, and try s = s.replace('\u009D', '<character of choice>'), the character isn't replaced. When I output the string the 9D and 8F characters show as ? (a question mark) Any ideas how I can replace these characters would by highly appreciated!
java is naturally inclined to use latin iso-1, but it appears you are reading in from a different char set. if you post some more code we can take a look to see if you are reading in the characters correctly. where are you trying to print them, and how? look here for a helpful tutorial by one of the guys on the original oak team: in depth look at java characters
|
use the [CODE] tags - it makes it much easier for people to help you.
|
 |
 |
|
|
subject: identify and replace special character
|
|
|