Forums de discussion

Strange Issue - Text Becomes u004D\u0061\u0074\u0068\u002E\u0073\u0069\u006

Rafał Płaszczyk, modifié il y a 6 années.

Strange Issue - Text Becomes u004D\u0061\u0074\u0068\u002E\u0073\u0069\u006

New Member Publications: 24 Date d'inscription: 05/07/17 Publications récentes
When I click gear icon on my portlet, options are not displayed in normal text, but in something like:
u004D\u0061\u0074\u0068\u002E\u0073\u0069\u006E\u0028\u006F\u005B\u0069\u005D\u0029\u003B\u006A\u005B\u0069
(check attached pic)

Has anyone encountered this issue? How to fix it?
thumbnail
Olaf Kock, modifié il y a 6 années.

RE: Strange Issue - Text Becomes u004D\u0061\u0074\u0068\u002E\u0073\u0069\

Liferay Legend Publications: 6403 Date d'inscription: 23/09/08 Publications récentes
Rafał Płaszczyk:
When I click gear icon on my portlet, options are not displayed in normal text, but in something like:
u004D\u0061\u0074\u0068\u002E\u0073\u0069\u006E\u0028\u006F\u005B\u0069\u005D\u0029\u003B\u006A\u005B\u0069
...

Has anyone encountered this issue? How to fix it?


I've never seen that. Which (exact) version are you running? My first guess is that something went wrong with the encoding, the problem is: On which level? Please double check the generated HTML and identify if you have any proxy, forwarder or something (e.g. Apache httpd, nginx) in between your appserver and your browser. Also, how did you configure your appserver
Rafał Płaszczyk, modifié il y a 6 années.

RE: Strange Issue - Text Becomes u004D\u0061\u0074\u0068\u002E\u0073\u0069\

New Member Publications: 24 Date d'inscription: 05/07/17 Publications récentes
Liferay Portal Community Edition 6.2 CE GA6 (Newton / Build 6205 / January 6, 2016)
thumbnail
David H Nebinger, modifié il y a 6 années.

RE: Strange Issue - Text Becomes u004D\u0061\u0074\u0068\u002E\u0073\u0069\

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes
Rafał Płaszczyk:
When I click gear icon on my portlet, options are not displayed in normal text, but in something like:
u004D\u0061\u0074\u0068\u002E\u0073\u0069\u006E\u0028\u006F\u005B\u0069\u005D\u0029\u003B\u006A\u005B\u0069
(check attached pic)


This is the unicode encoded representation of the text. It points to your database not being configured to use UTF-8, probably just plain ascii.






Come meet me at Devcon 2017 or 2017 LSNA!
Rafał Płaszczyk, modifié il y a 6 années.

RE: Strange Issue - Text Becomes u004D\u0061\u0074\u0068\u002E\u0073\u0069\

New Member Publications: 24 Date d'inscription: 05/07/17 Publications récentes
This is weird though, because my portlet consists of 3 steps of data input, and after each step the page is refreshed.

At the initial step and after the first refresh (in the second step), options under the gear icon appear normally.

It takes the second refresh (when I'm in the third step), that the options under the gear break and become unreadable.

So the problem appears after the second refresh, in the third step, but I have no idea what may be the cause.
Rafał Płaszczyk, modifié il y a 6 années.

RE: Strange Issue - Text Becomes u004D\u0061\u0074\u0068\u002E\u0073\u0069\

New Member Publications: 24 Date d'inscription: 05/07/17 Publications récentes
David H Nebinger:

It points to your database not being configured to use UTF-8, probably just plain ascii.


The database is set to UTF-8. Liferay is responsible for displaying those options in the menu - for example, it changes them depending on the chosen language. I think the issue might be somewhere on the Liferay's side. Where do I find the code responsible for displaying those options?
Rafał Płaszczyk, modifié il y a 6 années.

RE: Strange Issue - Text Becomes u004D\u0061\u0074\u0068\u002E\u0073\u0069\

New Member Publications: 24 Date d'inscription: 05/07/17 Publications récentes
I also tried setting:

jdbc:postgresql://localhost:5432/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false


to no avail.

So the issue appears only in this specific scenario in this portlet:
- when you add the portlet to your site, the first xhtml is used
- when you fill some input within it and click 'next', another xhtml is loaded and the page is refreshed
- again, you fill some input and click 'next', page refresh
- another xhtml is loaded and only at this moment the issue appears. When the first two xhtmls are presented, there is no issue. However, after examining the third xhtml's code, there's nothing within it that could cause the issue. It feels like it's more because of refreshing the page 2 times - like if it confused Liferay.
thumbnail
Christoph Rabel, modifié il y a 6 années.

RE: Strange Issue - Text Becomes u004D\u0061\u0074\u0068\u002E\u0073\u0069\

Liferay Legend Publications: 1554 Date d'inscription: 24/09/09 Publications récentes
Have you tried to look at the text encoding in the browser? (e.g. in Firefox with Right-Click -> Page info). Maybe the text encoding changes on the frontend. You can also try to override it manually in the browser, when the error happens. If that works, your pages somehow mess with the encoding. Maybe they contain a <meta charset="something"/>?
Rafał Płaszczyk, modifié il y a 6 années.

RE: Strange Issue - Text Becomes u004D\u0061\u0074\u0068\u002E\u0073\u0069\

New Member Publications: 24 Date d'inscription: 05/07/17 Publications récentes
Christoph Rabel:
Have you tried to look at the text encoding in the browser? (e.g. in Firefox with Right-Click -> Page info). Maybe the text encoding changes on the frontend. You can also try to override it manually in the browser, when the error happens. If that works, your pages somehow mess with the encoding. Maybe they contain a <meta charset="something"/>?



Charset is set to UTF8.

The HTML is generated like this:
<i class="icon-wrench"></i>  <span class="taglib-text-icon">\u0043\u006f\u006e\u0066\u0069\u0067\u0075\u0072\u0061\u0074\u0069\u006f\u006e</span>


So to me it seems that Liferay fails to convert it to normal characters. The browser simply gets what Liferay sends and treats \u0043 as a normal 6-letter word.