Elastic Path Commerce Development

Character set encoding

Character set encoding

The default encoding in Elastic Path is UTF-8. This applies to:

  • Database data
  • Database communications
  • Content (HTML pages, emails)
  • Data files (import data files, report files)
  • URLs (catalog browsing URLs, search URLs)

Setting the database encoding

You will need to specify the encoding when you create a database and set your database server to use the same encoding. For example, to use the UTF-8 encoding for a MySQL database, create the database as follows:

create database DB_NAME character set utf8;

Make sure the MySQL Server encoding is set to UTF-8:

  • In the Server my.ini file (.../MySQL/MySQL Server 5.1/my.ini), set the default-character-set to utf8:

The corresponding JDBC URI is:


Specifying the encoding type in the JDBC URL ("jdbc:mysql://localhost:3306/COMMERCE_DB?autoReconnect=true&useUnicode=true&characterEncoding=UTF8"), won't be enough to set database communications to use UTF-8. Character encoding is overridden by the MySQL Server's character setting.


You may encounter problems when using some Asian encodings that use a double wide character set, which makes some fields require twice as much storage space. In this case, the schema may need to be updated to accommodate the longer strings.

Setting content encoding

  1. Change the "HTML Encoding" value in the Store configuration of the Commerce Manager.
  2. Change the following settings in velocity.xml
    <prop key="template.encoding">UTF-8</prop>
    <prop key="input.encoding">UTF-8</prop>
    <prop key="output.encoding">UTF-8</prop>
  3. Change the following settings in web.xml:
    <!-- Encoding filter -->
        <filter-name>Encoding Filter</filter-name>

Setting the URL encoding

To change the encoding for URLs, modify the URL_ENCODING constant in com.elasticpath.commons.constants.WebConstants.


Changing the encoding for URLs is not recommended.