Charsets:Adding a new charset

From OpenEMM User Wiki

Jump to: navigation, search

This article describes the procedure, to add a new charset to OpenEMM.

As an example, we add windows-1252 (also knows as cp1252) to OpenEMM. All readable characters of ISO-8859-1 and ISO-8859-15 have a representation in cp1252. In other words: cp1252 is a superset of ISO-8859-1 and ISO-8859-15 concerning readable characters. Especially the €-character has a representation in cp1252, but not in ISO-8859-1.

But see yourself:


These are the character, that cp1252 adds to ISO-8859-1:

€ ‚ ƒ „ … † ‡ ˆ ‰ Š ‹ Œ Ž ‘ ’ “ ” • – — ˜ ™ š › œ ž Ÿ

These are the character, that cp1252 adds to ISO-8859-15:

‚ ƒ „ … † ‡ ˆ ‰ ‹ ‘ ’ “ ” • – — ˜ ™ ›


Furthermore, Browsers (including IE and FireFox) usually interpretate ISO-8859-1 pages with cp1252. So even, if the cp1252 would be wrongly decoded as ISO-8859-1 by webmailers like web.de, it will still be shown correctly by Browsers. This might improve compatibility with webmailers.


For more information about compatibility, look at this chart.


Contents

Add the charset to OpenEMM's internal list

  • open htdocs/WEB-INF/classes/navigation/charsets.properties
  • add these lines to the file:
msg_6=cp1252
href_6=windows-1252
token_6=charset.use.cp1252


Here is a short expaination of the 3 values:

  • "msg_6" the key, that we will have to use below, to assign a textual description.
  • "href_6" is the actual name of the charset like it will be used in the headers of the mail.
  • "token_6" defines the name of the priviledge.


Note: You have to chose a free number. If 6 is used, chose 7 - if 7 is used, chose 8 - and so on.

Note: There must not be any unused numbers. Don't use 5 and 7, but not 6.

Add translations for the GUI

  • open htdocs/WEB-INF/classes/messages.properties
  • open htdocs/WEB-INF/classes/messages_de.properties
  • open htdocs/WEB-INF/classes/messages_en.properties
  • to each of these files, add the following lines:
UserRight.Charsets.charset.use.cp1252=Codepage 1252 (Windows)
cp1252=Codepage 1252 (Windows)


The first of the two lines, adds a translation for the "charset.use.cp1252"-priviledge. You will se that in the in user-admin. The second line adds a translation for the charset itself. You will see that text in the dropdown-boxes, for example when you chose the charset of a mailing or the charset for an import.


Note: The keys of both translations have to match the keys chosen above.

Grant the priviledge for the new charset to the admin-user

  • open the MySQL-database (with phpMyAdmin for example)
  • execute the following SQL:
INSERT INTO admin_group_permission_tbl SET admin_group_id=4, security_token="charset.use.cp1252"


Note: The priviledge has to match the name chosen above.

Restart OpenEMM

OpenEMM seems to use a lot of caches. That's why the changes will not appear immediatly. We have to restart OpenEMM, and we have to clear all JSP-Session. Therefor we do the following:

  • find the folder htdocs/WEB-INF/sessions
  • stop OpenEMM (/etc/init.d/openemm stop)
  • remove all files within htdocs/WEB-INF/sessions
  • start OpenEMM (/etc/init.d/openemm start)



After you performed the steps above, a new charset will be available in OpenEMM.

Have fun!

Views
Personal tools