Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

How to set Wildfly 15's encoding to ISO-8859-15??

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm running a legacy project on Wildfly 15. The projects resources are encoded in ISO-8859-15 (cannot be changed). The HTML's meta tags declare content type like

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15">

Moreover I set the following definition in standalone-full.xml:

<server name="default-server">
  <http-listener name="default" socket-binding="http" url-charset="ISO-8859-15" redirect-socket="https" enable-http2="true"/>
  <https-listener name="https" socket-binding="https" url-charset="ISO-8859-15" security-realm="ApplicationRealm" enable-http2="true"/>
  ...
<servlet-container name="default" default-encoding="ISO-8859-15" use-listener-encoding="true">


Still I see UTF-8 as content-type in the response headers served by Wildfly.

Problems arise for example with jQuery resources (e.g. datepicker) where german umlauts are not displayed correctly.

What am I missing out? What is the correct way to set the encodings for Wildfly to be ISO-8859-15?

Best regards

Mark.
 
Saloon Keeper
Posts: 12421
269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How is the HTML served? Are requests handled by a servlet?
 
Mark Fried
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, they are JSPs - sorry forgot to mention this.

M.
 
Stephan van Hulst
Saloon Keeper
Posts: 12421
269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you already done a search through the project for "UTF-8", to see if this encoding is set somewhere explicitly?

In the JSPs that you serve, have you set the contentType and pageEncoding attributes in the page directive?
 
Mark Fried
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's all done correctly - running on Weblogic (which is configured for ISO-8859-15) everything works fine, the response headers are ISO there, too.

The created HTMLs have the correct meta setting on Wildfly (see above), only the respone headers set encoding to be UTF-8 - so I guess, I need to configure Wildfly accordingly.
 
Stephan van Hulst
Saloon Keeper
Posts: 12421
269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That it does this in WebLogic is inconsequential. Can you confirm that you've set the contentType property in your JSP pages? Setting the content type as a meta tag in the HTML isn't enough, because that doesn't determine in which encoding the HTML it served, only how it is to be parsed by a client.

Can you also tell us which Java EE version you're using?
 
Mark Fried
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your hint - I explicitly set encoding in the JSB's page declaration and then it's ok.

Unfortunately I've got som 500 JSP pages here and was hoping to find a setting in Wildfly so that I would not need to change every single JSP.

Is there no way to change encoding for a Wildfly instance like it's possible for our old Weblogic server?

Best regards

Mark.
 
Stephan van Hulst
Saloon Keeper
Posts: 12421
269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What version of the Servlet spec is your application using? Depending on the version, you might be able to configure your JSPs by putting the following element in your web.xml:
 
I wish to win the lottery. I wish for a lovely piece of pie. And I wish for a tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic