-
Notifications
You must be signed in to change notification settings - Fork 951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
grails .gsp changes the 'ñ' to 'ñ' when it reaches the controller #13350
Comments
Hi @funcoleto. I cannot reproduce the issue you are reporting. Could you please provide an example app that shows this behavior? |
with sample app grails-cas-encoding curl -si -dstring=® http://localhost:8080/application string: ® It's the same problem.. it always change special character.. |
I'm unsure if this is helpful, but this thread helped me resolve the reverse problem. In my messages_es.properties, I had messages containing ñ character, but in the view, it resulted in a � character. So I replaced ñ with ñ, and it rendered in the HTML as ñ. messages_es.properties
Resulting message
or in messages_fr.properties, é will give me é
results in this text
|
@funcoleto - I see Is your database encoding also UTF-8? Any chance it's ISO8859? For example with PostgreSQL you can easily see your database encoding by using the command Could it be your LC_* environment variables causing a problem? Supposedly PostgreSQL can determine your system encoding when the database is created by examining the LC_CTYPE environment variable. In your In your
Take a look at your Take a look at your Does your
(I guess it must based on your results with curl above). That's about all I can think of. For what it's worth, I have tons of data in the PostgreSQL back end in UTF-8 with accented characters etc and it all comes out fine. |
On the traveling Mac it gives me problems when starting the project, on Sunday I test when I get home again, On the travel mac it gives me this problem I think because of the gradle / groovy..
|
In the project "sample app grails-cas-encoding"Everything put above is position, the database does not act therefore the database is discarded, in the project "grails-cas-encoding" This was missing (> Take a look at your terminal: HTTP/1.1 200 string: ñ example2: HTTP/1.1 200 string: ® If you start the project and go to the browser and put: The result is: I'm with intellij and the whole project is with utf8 |
Hello again! I was formatting the computers and the same thing happens to me, if I do this from the terminal: I have seen that if I do this from the terminal: curl -si -dstring=ñ -H "Content-Type: application/x-www-form-urlencoded; charset=utf-8" http://localhost:8080/application and yes, it returns the expected form: HTTP/1.1 200 string: ñ but it is curious that if I send this request with curl and I make sure that everything is in utf-8: curl -si --data-urlencode "string=ñ" http://localhost:8080/application fails again: HTTP/1.1 200 string: ñ here are the differences between the three curl requests you mentioned: 1._ curl -si -dstring=ñ -H "Content-Type: application/x-www-form-urlencoded; charset=utf-8" http://localhost:8080/application: In this request, you’re sending the data as is, without encoding special characters. The “Content-Type” header with “charset=utf-8” indicates that the form data is encoded in UTF-8. However, curl does not automatically encode special characters in the form data. 2._ curl -si --data-urlencode "string=ñ" http://localhost:8080/application: In this request, you’re using the --data-urlencode option, which tells curl to encode the form data. This means that curl will automatically encode special characters. 3._curl -si -dstring=ñ http://localhost:8080/application: In this request, you’re sending the data as is, without encoding special characters and without specifying the encoding in the HTTP header. This can cause problems if the data contains special characters and the server expects a specific encoding. 1 👍 🤷♂️ |
Expected Behavior
When I put characters with an accent or 'ñ' in some string field, instead of reaching the controller, the literal text arrives changed if they are special characters
Actual Behaviour
I put a 'ñ, ó á é' in the string input text .gsp view...... and when they already travel to the controller, they have already changed to these values 'ñ , ó á é'..
Steps To Reproduce
1._ bootrun proyect
2._ register like propietario with some special character ñ, ó, á, etc..
3._ and in the database you can see that they are not the same characters, they arrive at the controller already changed
Environment Information
development, production
Grails Version: 6.1.1
JVM Version: 11.0.16
Groovy Version: 4.0.15
OS: Mac OS X
openjdk 11.0.21 2023-10-17 LTS
OpenJDK Runtime Environment Corretto-11.0.21.9.1 (build 11.0.21+9-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.21.9.1 (build 11.0.21+9-LTS, mixed mode)
intellij
Example Application
No response
Version
6.1.0
The text was updated successfully, but these errors were encountered: