Spring boot 2.1 / java 11 app not recognizing accentuated characters after migrating from Spring boot 2.0.5 /...











up vote
1
down vote

favorite
1












I have a Spring boot web app that used to work perfectly fine on java 8 and Spring boot 2.0.5. Now, when i visit any page and try to input data that has a É character for example, the character is saved as ? in the database and obviously retrieved as such. I have changed 0 code aside from adding the javax.json.bind-api dependency that is no longer built into the JRE. Is there some sort of global character encoding property that needs to be changed for non-standard characters to be recognized properly?



EDIT



This is the relevant bit of my JSP page :



<form:form method="POST" modelAttribute="medClass" class="form-style-7">
<form:input path="name" id="name"/>
</form:form>


Controller code :



@RequestMapping(value = {"/newMedClass"}, method = RequestMethod.POST)
public String saveMedClass(@Valid MedClass medClass, BindingResult result, ModelMap model)
{
boolean hasCustomErrors = validate(result, medClass);
if ((hasCustomErrors) || (result.hasErrors()))
{
setPermissions(model);

return "medClassDataAccess";
}
medClassService.save(medClass);
session.setAttribute("successMessage", "Successfully added med class "" + medClass.getName() + ""!");
return "redirect:/medClasses/list";
}


When entering ÉÉÉÉ as the name for this entity (yes it's a string), the entity comes into the controller with ???? already and is therefore saved as such.



EDIT



I have this line at the top of every JSP :



<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>


Does this need to be changed?



Thanks










share|improve this question




















  • 1




    Is that character a part of a string or maybe a property file? Just speculating based on the restricted information this might be because of the UTF-8 default encoding now.
    – nullpointer
    Nov 13 at 0:31












  • The issue is with the actual data entered by the user, which is saved as entities into a MSSQL database using Hibernate.
    – Martin
    Nov 13 at 17:08










  • how is it read by your application? as a string?
    – nullpointer
    Nov 13 at 17:09










  • please see my edits for clarifications and code
    – Martin
    Nov 14 at 12:26















up vote
1
down vote

favorite
1












I have a Spring boot web app that used to work perfectly fine on java 8 and Spring boot 2.0.5. Now, when i visit any page and try to input data that has a É character for example, the character is saved as ? in the database and obviously retrieved as such. I have changed 0 code aside from adding the javax.json.bind-api dependency that is no longer built into the JRE. Is there some sort of global character encoding property that needs to be changed for non-standard characters to be recognized properly?



EDIT



This is the relevant bit of my JSP page :



<form:form method="POST" modelAttribute="medClass" class="form-style-7">
<form:input path="name" id="name"/>
</form:form>


Controller code :



@RequestMapping(value = {"/newMedClass"}, method = RequestMethod.POST)
public String saveMedClass(@Valid MedClass medClass, BindingResult result, ModelMap model)
{
boolean hasCustomErrors = validate(result, medClass);
if ((hasCustomErrors) || (result.hasErrors()))
{
setPermissions(model);

return "medClassDataAccess";
}
medClassService.save(medClass);
session.setAttribute("successMessage", "Successfully added med class "" + medClass.getName() + ""!");
return "redirect:/medClasses/list";
}


When entering ÉÉÉÉ as the name for this entity (yes it's a string), the entity comes into the controller with ???? already and is therefore saved as such.



EDIT



I have this line at the top of every JSP :



<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>


Does this need to be changed?



Thanks










share|improve this question




















  • 1




    Is that character a part of a string or maybe a property file? Just speculating based on the restricted information this might be because of the UTF-8 default encoding now.
    – nullpointer
    Nov 13 at 0:31












  • The issue is with the actual data entered by the user, which is saved as entities into a MSSQL database using Hibernate.
    – Martin
    Nov 13 at 17:08










  • how is it read by your application? as a string?
    – nullpointer
    Nov 13 at 17:09










  • please see my edits for clarifications and code
    – Martin
    Nov 14 at 12:26













up vote
1
down vote

favorite
1









up vote
1
down vote

favorite
1






1





I have a Spring boot web app that used to work perfectly fine on java 8 and Spring boot 2.0.5. Now, when i visit any page and try to input data that has a É character for example, the character is saved as ? in the database and obviously retrieved as such. I have changed 0 code aside from adding the javax.json.bind-api dependency that is no longer built into the JRE. Is there some sort of global character encoding property that needs to be changed for non-standard characters to be recognized properly?



EDIT



This is the relevant bit of my JSP page :



<form:form method="POST" modelAttribute="medClass" class="form-style-7">
<form:input path="name" id="name"/>
</form:form>


Controller code :



@RequestMapping(value = {"/newMedClass"}, method = RequestMethod.POST)
public String saveMedClass(@Valid MedClass medClass, BindingResult result, ModelMap model)
{
boolean hasCustomErrors = validate(result, medClass);
if ((hasCustomErrors) || (result.hasErrors()))
{
setPermissions(model);

return "medClassDataAccess";
}
medClassService.save(medClass);
session.setAttribute("successMessage", "Successfully added med class "" + medClass.getName() + ""!");
return "redirect:/medClasses/list";
}


When entering ÉÉÉÉ as the name for this entity (yes it's a string), the entity comes into the controller with ???? already and is therefore saved as such.



EDIT



I have this line at the top of every JSP :



<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>


Does this need to be changed?



Thanks










share|improve this question















I have a Spring boot web app that used to work perfectly fine on java 8 and Spring boot 2.0.5. Now, when i visit any page and try to input data that has a É character for example, the character is saved as ? in the database and obviously retrieved as such. I have changed 0 code aside from adding the javax.json.bind-api dependency that is no longer built into the JRE. Is there some sort of global character encoding property that needs to be changed for non-standard characters to be recognized properly?



EDIT



This is the relevant bit of my JSP page :



<form:form method="POST" modelAttribute="medClass" class="form-style-7">
<form:input path="name" id="name"/>
</form:form>


Controller code :



@RequestMapping(value = {"/newMedClass"}, method = RequestMethod.POST)
public String saveMedClass(@Valid MedClass medClass, BindingResult result, ModelMap model)
{
boolean hasCustomErrors = validate(result, medClass);
if ((hasCustomErrors) || (result.hasErrors()))
{
setPermissions(model);

return "medClassDataAccess";
}
medClassService.save(medClass);
session.setAttribute("successMessage", "Successfully added med class "" + medClass.getName() + ""!");
return "redirect:/medClasses/list";
}


When entering ÉÉÉÉ as the name for this entity (yes it's a string), the entity comes into the controller with ???? already and is therefore saved as such.



EDIT



I have this line at the top of every JSP :



<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>


Does this need to be changed?



Thanks







java spring-boot character-encoding non-ascii-characters java-11






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 at 13:44

























asked Nov 12 at 20:36









Martin

9519




9519








  • 1




    Is that character a part of a string or maybe a property file? Just speculating based on the restricted information this might be because of the UTF-8 default encoding now.
    – nullpointer
    Nov 13 at 0:31












  • The issue is with the actual data entered by the user, which is saved as entities into a MSSQL database using Hibernate.
    – Martin
    Nov 13 at 17:08










  • how is it read by your application? as a string?
    – nullpointer
    Nov 13 at 17:09










  • please see my edits for clarifications and code
    – Martin
    Nov 14 at 12:26














  • 1




    Is that character a part of a string or maybe a property file? Just speculating based on the restricted information this might be because of the UTF-8 default encoding now.
    – nullpointer
    Nov 13 at 0:31












  • The issue is with the actual data entered by the user, which is saved as entities into a MSSQL database using Hibernate.
    – Martin
    Nov 13 at 17:08










  • how is it read by your application? as a string?
    – nullpointer
    Nov 13 at 17:09










  • please see my edits for clarifications and code
    – Martin
    Nov 14 at 12:26








1




1




Is that character a part of a string or maybe a property file? Just speculating based on the restricted information this might be because of the UTF-8 default encoding now.
– nullpointer
Nov 13 at 0:31






Is that character a part of a string or maybe a property file? Just speculating based on the restricted information this might be because of the UTF-8 default encoding now.
– nullpointer
Nov 13 at 0:31














The issue is with the actual data entered by the user, which is saved as entities into a MSSQL database using Hibernate.
– Martin
Nov 13 at 17:08




The issue is with the actual data entered by the user, which is saved as entities into a MSSQL database using Hibernate.
– Martin
Nov 13 at 17:08












how is it read by your application? as a string?
– nullpointer
Nov 13 at 17:09




how is it read by your application? as a string?
– nullpointer
Nov 13 at 17:09












please see my edits for clarifications and code
– Martin
Nov 14 at 12:26




please see my edits for clarifications and code
– Martin
Nov 14 at 12:26












1 Answer
1






active

oldest

votes

















up vote
2
down vote



accepted










Changing the JSPs' charset to UTF-8 fixed it. How this worked perfectly before is a complete mystery...



<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">





share|improve this answer





















  • Thanks for sharing, would certainly be useful for future readers :)
    – nullpointer
    Nov 14 at 17:52












  • I hope so! This is very strange, like i said everything worked perfectly with Spring Boot 2.0.5 and java 8 and those lines contained ISO-8859-1 in all of my 60+ JSP pages.
    – Martin
    Nov 14 at 17:53











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269708%2fspring-boot-2-1-java-11-app-not-recognizing-accentuated-characters-after-migra%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
2
down vote



accepted










Changing the JSPs' charset to UTF-8 fixed it. How this worked perfectly before is a complete mystery...



<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">





share|improve this answer





















  • Thanks for sharing, would certainly be useful for future readers :)
    – nullpointer
    Nov 14 at 17:52












  • I hope so! This is very strange, like i said everything worked perfectly with Spring Boot 2.0.5 and java 8 and those lines contained ISO-8859-1 in all of my 60+ JSP pages.
    – Martin
    Nov 14 at 17:53















up vote
2
down vote



accepted










Changing the JSPs' charset to UTF-8 fixed it. How this worked perfectly before is a complete mystery...



<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">





share|improve this answer





















  • Thanks for sharing, would certainly be useful for future readers :)
    – nullpointer
    Nov 14 at 17:52












  • I hope so! This is very strange, like i said everything worked perfectly with Spring Boot 2.0.5 and java 8 and those lines contained ISO-8859-1 in all of my 60+ JSP pages.
    – Martin
    Nov 14 at 17:53













up vote
2
down vote



accepted







up vote
2
down vote



accepted






Changing the JSPs' charset to UTF-8 fixed it. How this worked perfectly before is a complete mystery...



<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">





share|improve this answer












Changing the JSPs' charset to UTF-8 fixed it. How this worked perfectly before is a complete mystery...



<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 14 at 13:50









Martin

9519




9519












  • Thanks for sharing, would certainly be useful for future readers :)
    – nullpointer
    Nov 14 at 17:52












  • I hope so! This is very strange, like i said everything worked perfectly with Spring Boot 2.0.5 and java 8 and those lines contained ISO-8859-1 in all of my 60+ JSP pages.
    – Martin
    Nov 14 at 17:53


















  • Thanks for sharing, would certainly be useful for future readers :)
    – nullpointer
    Nov 14 at 17:52












  • I hope so! This is very strange, like i said everything worked perfectly with Spring Boot 2.0.5 and java 8 and those lines contained ISO-8859-1 in all of my 60+ JSP pages.
    – Martin
    Nov 14 at 17:53
















Thanks for sharing, would certainly be useful for future readers :)
– nullpointer
Nov 14 at 17:52






Thanks for sharing, would certainly be useful for future readers :)
– nullpointer
Nov 14 at 17:52














I hope so! This is very strange, like i said everything worked perfectly with Spring Boot 2.0.5 and java 8 and those lines contained ISO-8859-1 in all of my 60+ JSP pages.
– Martin
Nov 14 at 17:53




I hope so! This is very strange, like i said everything worked perfectly with Spring Boot 2.0.5 and java 8 and those lines contained ISO-8859-1 in all of my 60+ JSP pages.
– Martin
Nov 14 at 17:53


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269708%2fspring-boot-2-1-java-11-app-not-recognizing-accentuated-characters-after-migra%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Guess what letter conforming each word

Port of Spain

Run scheduled task as local user group (not BUILTIN)