<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>How to set REST API character encoding</title>
  <link rel="self" href="https://liferay.dev/sv/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=60431496" />
  <subtitle>How to set REST API character encoding</subtitle>
  <id>https://liferay.dev/sv/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=60431496</id>
  <updated>2026-06-02T21:19:27Z</updated>
  <dc:date>2026-06-02T21:19:27Z</dc:date>
  <entry>
    <title>RE: How to set REST API character encoding</title>
    <link rel="alternate" href="https://liferay.dev/sv/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60489508" />
    <author>
      <name>Jan Beran</name>
    </author>
    <id>https://liferay.dev/sv/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60489508</id>
    <updated>2015-10-07T16:36:25Z</updated>
    <published>2015-10-07T16:36:25Z</published>
    <summary type="html">Hi David&lt;br /&gt;&lt;br /&gt;The database uses UTF-8 character set.</summary>
    <dc:creator>Jan Beran</dc:creator>
    <dc:date>2015-10-07T16:36:25Z</dc:date>
  </entry>
  <entry>
    <title>RE: How to set REST API character encoding</title>
    <link rel="alternate" href="https://liferay.dev/sv/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60487215" />
    <author>
      <name>David H Nebinger</name>
    </author>
    <id>https://liferay.dev/sv/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60487215</id>
    <updated>2015-10-07T15:52:08Z</updated>
    <published>2015-10-07T15:52:08Z</published>
    <summary type="html">Do you know what character set your mysql database was created using?&lt;br /&gt;&lt;br /&gt;USE db_name;&lt;br /&gt;SELECT @@character_set_database;</summary>
    <dc:creator>David H Nebinger</dc:creator>
    <dc:date>2015-10-07T15:52:08Z</dc:date>
  </entry>
  <entry>
    <title>RE: How to set REST API character encoding</title>
    <link rel="alternate" href="https://liferay.dev/sv/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60486951" />
    <author>
      <name>Jan Beran</name>
    </author>
    <id>https://liferay.dev/sv/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60486951</id>
    <updated>2015-10-07T15:40:16Z</updated>
    <published>2015-10-07T15:40:16Z</published>
    <summary type="html">Thanks for the reply David.&lt;br /&gt;&lt;br /&gt;So, I digged deep and found what the problem was. Some of the accented characters are encoded as two bytes in UTF-8. For example, á is encoded as %C3%A1. This was fine while using the Hypersonic database at my localhost. But the MySQL database of the testing portal reads the REST URL one byte at a time and understands the above example as Ã¡. &lt;br /&gt;A partial solution for this is to encode all problematic characters as HTML entities, i.e á becomes &amp;amp;#225;. The database consumes such request without problem. The data are then stored with the HTML entities in the database, but are displayed OK in the portal GUI.&lt;br /&gt;&lt;br /&gt;Is there any better solution to this, that would store the data in a correct way?&lt;br /&gt;&lt;br /&gt;Another interesting problem, that came along while finding this solution - when I changed the default portal language to english, the database still consumed the REST service, but was only creating empty records in the DDL, i.e. no data were saved. Is that a bug or feature?</summary>
    <dc:creator>Jan Beran</dc:creator>
    <dc:date>2015-10-07T15:40:16Z</dc:date>
  </entry>
  <entry>
    <title>RE: How to set REST API character encoding</title>
    <link rel="alternate" href="https://liferay.dev/sv/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60446403" />
    <author>
      <name>David H Nebinger</name>
    </author>
    <id>https://liferay.dev/sv/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60446403</id>
    <updated>2015-10-07T00:07:43Z</updated>
    <published>2015-10-07T00:07:43Z</published>
    <summary type="html">Database is outside of Liferay forums and it will vary.  For example, with mysql you have to indicate utf8 characterset when you&amp;#39;re creating the database.&lt;br /&gt;&lt;br /&gt;Application servers, well I&amp;#39;ve never had to switch one on/off so I just kind of assume that they will support it automagically.  If you&amp;#39;re running on a windows server that&amp;#39;s probably a bad assumption, but I couldn&amp;#39;t tell you how to go about fixing it.</summary>
    <dc:creator>David H Nebinger</dc:creator>
    <dc:date>2015-10-07T00:07:43Z</dc:date>
  </entry>
  <entry>
    <title>How to set REST API character encoding</title>
    <link rel="alternate" href="https://liferay.dev/sv/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60431495" />
    <author>
      <name>Jan Beran</name>
    </author>
    <id>https://liferay.dev/sv/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60431495</id>
    <updated>2015-10-06T16:34:38Z</updated>
    <published>2015-10-06T16:34:38Z</published>
    <summary type="html">Hello everybody&lt;br /&gt;&lt;br /&gt;I recently ran into a problem with using the portal REST services to upload data to the portal. I programmed a small application that read Excel files and makes them into DDL lists and KB articles by sending them with the REST API.&lt;br /&gt;Everything was working fine while I was using the localhost portal to get the application running. But then I switched to the testing portal environment, and I encountered a small problem with characters encoding.&lt;br /&gt;All the data that I send through the REST API have non-English characters (áíé and similar) replaced with Latin characters. The conversion chart is same as &lt;a href="http://www.i18nqa.com/debug/utf8-debug.html"&gt;here&lt;/a&gt;. So the trouble is with UTF-8 encoding being interpreted as Windows-1252.&lt;br /&gt;I was not yet able to view the database data directly, but when I request them through the REST APi, they are already garbled.&lt;br /&gt;Also, all data entered in the portal GUI are fine even with non-English characters.&lt;br /&gt;&lt;br /&gt;My question is, how to check (and also set) the database and application server encoding to UTF-8 to interpret the data sent through REST APi correctly and show them in the right way?&lt;br /&gt;&lt;br /&gt;Any advice is much appreciated, thanks.</summary>
    <dc:creator>Jan Beran</dc:creator>
    <dc:date>2015-10-06T16:34:38Z</dc:date>
  </entry>
</feed>
