Strengthen JSF to remove special characters in unicode

Is it possible to force JSF to reset special characters in unicode-way ä , not in named-entity-way ä ?

Background: some old mobile devices (e.g. HTC-Desire with Android 2.3.4) refuse to display a page containing named objects:

This page contains the following errors ... Entity 'auml' is undefined.

The page has HTML5-Doctype and , according to the auml specification auml is a valid predefined symbolic link . Therefore, I think this is a browser error, but it does not help me.

I tried replacing special characters with their Unicode representation. But if I put รค or even ä in view, ä will make me ä . If I put a matching entity in doctype (I know this should not be done in HTML5-doctype), the behavior becomes really weird:

 <!DOCTYPE html [ <!ENTITY auml "&#228;"> <!ENTITY mdash "&#8212;"> ... ]> 

This will result in the correct HTML5 method without rendering. But a &mdash; will be replaced by &#8212; , a &auml; will not be replaced.

Does anyone explain this or is it possible to configure JSF for everyone displaying unicode-escaped entitites?

+4
source share
1 answer

This will happen if you set <f:view encoding> to an encoding that is not compatible with Unicode.

Correct it accordingly:

 <f:view encoding="UTF-8"> 

Since JSF2 is on Facelets, this default value is already, by the way, so you can safely omit it if you really use JSF2 on Facelets.

+1
source

Source: https://habr.com/ru/post/1500333/


All Articles