Strange character encoding

character encoding list
character encoding converter
character encoding utf-8
character encoding html
text encoding converter
encoding types
character encoding standards
ascii encoding

I have a project that runs on WebSphere Liberty on Linux. My language is brazilian portuguese and we have some accented words. My java code sets some user messages like below:

...
ErroResponse erroResponse = new ErroResponse();
erroResponse.setMensagem("Esse grupo não pode ser criado. Já existe um grupo criado com esse nome.");
response = Response.status(Status.BAD_REQUEST).entity(erroResponse).build();
...

When the same message is show to the user, it looks this way:

I don't think it's a browser encoding problem because the message looks the same on my server logs.

I've tried to set JVM encoding using -Dclient.encoding.override -Dfile.encoding to ISO-8859-1 and UTF-8, without success.

The same project, running on a Windows server, runs without problem, showing the messages with the correct accents.

Only message that were directly written in the source code has this problem. Accented words that came from database query result are correctly presented.

I'm using Suse 11.4.

I really appreciate any help.

Thanks

Try to check your Suse encoding and language, by doing:

$ echo $LC_CTYPE
ISO-8859-1

$ echo $LANG
pt_BR

Get all languages:

$ locale -a

Change to pt_PT.utf8:

$ export LC_ALL=pt_PT.utf8 
$ export LANG="$LC_ALL"

Strange character encoding, The computer representation of the code points is decided by the character encoding. An example of a character set is the 128-character ASCII� Sometimes, when copying text from notepad into the website coding, strange characters appear on the live website, can't remember all the instances over the years, but the latest this morning, was

It is likely that before adding those JVM encoding properties, you were getting UTF-8 encoding of that character in the response, but your browser was unwilling to interpret them as UTF-8. I'd suggest deleting them and keeping that within your JAX-RS resources.

A useful debugging step is to look at the respone with a command like client and hex editor (like od -t x1) because there are many things that can obscure what data is actually being transmitted (browser, terminal emulator, etc).

If you explicitly tell the server to use a charset (UTF-8 or a local codepage like ISO8859-1) your strings will be transformed to the specified codepage. The browser will also see the charset in the Content-Type header.

The simplest way is to use @Produces in JAX-RS as in:

@Produces("text/html; charset=UTF-8")

or

@Produces("text/html; charset=ISO8859-1")

Encoding - Getting Those Strange Characters to Behave, Getting weird characters like � instead of or �€™? do a mysql_query("SET NAMES 'utf8'"); to set the connection's encoding to utf-8, which is� It’s a character encoding thing, and I won’t go into too much detail on it, but suffice to say: WordPress stores your content in a MySQL database, encoded in a character set called UTF8.

The problem was solved changing the project text encoding. By default eclipse was saving the source code as UTF-8 and javac was compiling it as CP1252 (Windows Default).

To make this change I had to right click on Project -> Properties -> Resource then changed Text file encoding to Other (ISO-8859-1).

Character encoding, Strange and unwanted characters. This error is usually due to a character " encoding" problem and you may see unusual characters on your HTML webpages as� This is a list of Unicode characters; there are 143,859 characters, with Unicode 13.0, covering 154 modern and historical scripts, as well as multiple symbol sets.As it is not technically possible to list all of these characters in a single Wikipedia page, this list is limited to a subset of the most important characters for English-language readers, with links to other pages which list the

I've had a similar problem with maven and jax-ws service which returned bad characters (of text inside source code).

Resolved it by adding this to the parent maven project:

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Weird characters like � are showing up on my site – Code A Site Blog, To communicate effectively, we would need to agree on a standard way of encoding the characters. To this end, in the 1960s the American� For example, if your computer uses the Western European encoding standard (Windows), the character in the original Cyrillic file will be displayed in the E format instead of Й because Western European encoding cards (Windows) range from 201 to E. Configure the character set in Microsoft Outlook to send outgoing messages in Unicode (UTF-8).

Fixing strange webpage characters - HTML5, Tutorial How to fix subtitles appearing in weird symbols in any player ? If you see weird Duration: 2:48 Posted: Aug 7, 2019 View -> Text encoding -> Unicode about:config -> mailnews.force_charset_override = default / false It did not solve the problem to tick or untick "When possible, use the default text encoding in replies" I do not know how to access "View -> character encoding".

Unicode, UTF8 & Character Sets: The Ultimate Guide — Smashing , The encoding is UTF-8 (in the VIEW menu). What else can I do? Do I need to make all the plugin files utf-8 as well? FYI, this blog is one of�

How to Fix Subtitles weird characters encoding, In this tutorial, you'll get a Python-centric introduction to character encodings and be right to give me a strange look before answering that it represents eleven.

Comments
  • One (here unlikely) cause could be that the java source is edited as UTF-8 but compiled as for instance ISO-8859-1. (More often seen with JSPs.) Try by using \u00E3 instead of ã to check this.
  • how do I force it to compile as UTF-8 instead of ISO-8859-1?
  • @JoopEggen you're right. After your comment I could find a solution. Thanks.
  • I've tried to set to pt_BR.utf8 and en_US.iso885915. Still without success.
  • If you use Maven or a similar build tool, the declaration of the correct encoding belongs in the pom.xml (Maven) or build.properties (Gradle) or build.xml (Ant) file so that it survives a reinstallation of Eclipse.