ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Well, I have a web application in Linux server. All my Java codes are there.
FYI, whenever user entered non-ASCII characters(e.g. ∞,€,™) in a text field in my web application, and I check the log of my Java code in Linux server, it returns weird characters.
Suppose user entered ∞ in the text field. I should get ∞ in my log too. However, I got weird characters in return.
Well, I have a web application in Linux server. All my Java codes are there.
FYI, whenever user entered non-ASCII characters(e.g. ∞,€,™) in a text field in my web application, and I check the log of my Java code in Linux server, it returns weird characters.
Suppose user entered ∞ in the text field. I should get ∞ in my log too. However, I got weird characters in return.
Any idea? Is this a Linux bug?
If you expect a function in a programming language to read something in some manner, your expectations should be based on the official documentation of the function.
So, based on what official documentation, specifically, on which part of it do you expect the characters to be read the way you expect them to be read ?
This has absolutely nothing to do with the Linux OS.
Are you inputting the data using one character encoding and viewing it with another?
Everything entered by the user will be passed to my Java program to be inserted into database. On HTML side, I use UTF-8 as my character encoding. In Java, I use request.getParameter to get the value entered by the user. I don't think I have any encoding for that.
ps: Im working from the terminal, can terminal captures non-ASCII characters? Sorry, Im new in Linux.
I found out that my page was encoded in iso-8859-1 and echo $LANG in linux returns en_US.UTF-8.
MTK358 was right about it. However, I tried to change my page to use utf-8 as character encoding but to no avail.
Problem still persists. Why??
For your information, when I execute System.out.println("\u20AC"), I should have get € (Euro sign symbol). But what I get is a bunch of weird characters such as �
Can help?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.