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

鏡平學校

ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

Guess what letter conforming each word