• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Problem with special characters

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Our applications supports different languages. When I am trying to print a String in Linux, I am getting a ? instead of a spanish special character.I should get "Aveo recibi� distinci�n de Auto" but I am getting "Aveo recibi? distinci?n de Auto". I am using UTF-8 encoding.

When i tried the same in Windows in eclipse it is printing correctly with ISO-8859-1. But when I run the same program from command prompt I get a "<" error.

Could any of you please help me out with this.
Its very urgent friends.

-Nalini.
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The error can occur in two places: 1) When you compile or 2) when you run the program.

1) The compiler reads the source code file interpreting the bytes in it as a stream of characters using a character encoding. If it cannot interprete some byte as a character it replaces it with an "illegal character" symbol which almost always prints out as a question mark. The encoding that the compiler uses depends on the settings of the computer, or it can be set on the command line. Because the character encodings vary from platfrom to platform and user to user, it is more portable to write the source in ASCII and replace non-ASCII characters wtih unicode-escapes. For example you would write "Aveo recibi\u00f3 distinci\u00f3n de Auto." The native2ascii tool that is distributed with the JDK can make this conversion automatically.

2) When you run the program and print a String, the bytes that are printed to the console or file depend on the language settings of the user's system. If the language settings don't support some characters, they are replaced with question marks. On linux you can change the language settings by changing certain environment variables, namely LANG, LC_ALL, or LC_CTYPE. Try for example these commands:
See the manual page of the "locale" command for more information on the environment variables and ways to list available locales.

But when I run the same program from command prompt I get a "<" error.


What is a "<" error?
 
I'd appreciate it if you pronounced my name correctly. Pinhead, with a silent "H". Petite ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic