简体   繁体   中英

special character “” is not work in Linux, converted into “?”

I consuming an api which is returning String with special characters, so I replace them with blank or some other user readable char.

My code:

String text = response;
        if (text != null) {
            text = text.replace("Â", "");
            //same for other special char
        }

The above code works fine for windows machine but in Linux "Â" converted into "?", even other all special char converted into "?". I am using Java, UTF-8 in my HTML. Please let me know any platform independent solution. Thanks

I am consuming the REST api, so while getting the output I have to maintain UTF-8 encoding.

BufferedReader br = new BufferedReader(new InputStreamReader((inputStream), standardCharsets.UTF_8));

I have added standardCharsets.UTF_8

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM