• 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

identify and replace special character

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
reply
    Bookmark Topic Watch Topic
  • New Topic