This week's book giveaways are in the AI and JavaScript forums.
We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript 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
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • 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: 11147
244
  • 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: 11147
244
  • 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: 11147
244
  • 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: 11147
244
  • 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 am Arthur, King of the Britons. And this is a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!