Setting up a web example, when I received a string for the html projection from the application, I noticed an inconsistency. I would like help with this.
In one of the moments of the creation of the page I have a treatment of the object to be persisted, and the treatment is this:
//sobrenome - apenas caracteres
String s = v.getSobrenome();
if(s.isEmpty()||!Pattern.matches("[a-zA-Z]+", s))
v.setSobrenome("!INVALIDO!");
The only problem is that an invalid character (which is between the INVALID O and the exclamation) appeared magically, which does not take up space in the presentation, but is counted by the keyboard cursor. >
When I try to enter the folder of the class to get it from my work and take it home to analyze it, I entered the .java through the browser (Firefox) and I came across this:
//sobrenome - apenas caracteres
String s = v.getSobrenome();
if(s.isEmpty()||!Pattern.matches("[a-zA-Z]+", s))
v.setSobrenome("!INVALIDO„ƒ„ƒ„ƒ„ƒ„ƒ„ƒ„ƒ„ƒ„ƒ„ƒ„ƒ„ƒ„!ƒ");
I have no place for this character to have "appeared" in the class.
The good thing is that erasing would solve the problem, but I would like to know if someone has already encountered it, already treated and knows its origin.
EDITION
It's starting to get complicated for me. I copied the character and put it in a clean class, and when I tried to save Eclipse it gave me an error, saying it was impossible to save in a character format called "Cp1252".