|
PmWiki /
UTF-8
UTF-8 supports all languages and alphabets, including Asian languages and their character depth. It is a widely supported and flexible character encoding. It's fairly simple to enable UTF-8 on your wiki pages. Current Pm Wiki versions have the UTF-8 file which is enabled by default in the Enabling UTF-8 on a new wiki
If you start a new wiki in any language with the latest Pm Wiki version, it is highly recommended to enable UTF-8. In the future, Pm Wiki will change to use the UTF-8 encoding by default, so if you already use it, you will not need a complex "migration" to UTF-8 later. To enable UTF-8 for a new wiki, add this line near the beginning of include_once("scripts/xlpage-utf-8.php"); This line should come before a call to the Save your With UTF-8 thus enabled you also got use of classes rtl and ltr, which offer setting of the text direction to right-to-left, or left-to-right. This is useful for inclusion of right-to-left scripts like Arabic, Farsi (Persian), Hebrew, Urdu and others. Enabling UTF-8 on existing wikis
Until 2024, this was possible only if your group and page names, as well as upload names, didn't contain international characters. The names of wiki pages are used as file names, and we didn't have an easy way to rename the disk files. See the recipe Cookbook:MigrateUTF8 which may be able to migrate wiki page files and attachments, even with international characters, from an older encoding to UTF-8. If your wiki doesn't have international page/file names, first upgrade to the latest Pm Wiki version. To enable UTF-8:
include_once("scripts/xlpage-utf-8.php"); $DefaultPageCharset = array(''=>'ISO-8859-1'); # see below These lines should come before a call to the The $DefaultPageCharset line is there to fix and correctly handle some pages with missing or wrong attributes, created by older Pm Wiki versions.
Support for RTL right-to-left languages
Languages like Arabic, Hebrew, Farsi (Persian), Urdu and others are written in script flowing from right to left. Classes rtl and ltr can be used to specify direction of text independently of the general text direction within a page, for example:
To set text direction for a wiki generally to RTL, you could add to $HTMLStylesFmt['rtl'] = " body { direction:rtl; }"
but the skin you use may need other modifications, for instance to swap the search box and the page actions to the other side etc. Some skins have full support for RTL, see for instance Amber. Using UTF-8 in page names and UR Ls?
Enabling UTF-8 allows to use international characters in page names (for file names, see $UploadNameChars). There are good reasons to use UTF-8 in page names. Easier configuration, works out of the box. Easier management of page titles (no need to add a Also while the UR Ls? may have URL-encoded international characters when you copy them, modern browsers display the actual characters in the URL bar, and major search engines understand the international UR Ls? and show them decoded in the search results. On the other hand, some people may prefer to restrict page names and file names to plain ASCII characters, especially if the language mostly uses the Latin alphabet. One of the reasons may be to have plain UR Ls? like Today there shouldn't be many problems in using international characters in page and file names in UTF-8. But if some day you change servers or operating systems, plain Latin letters are more portable and there is less risk that something breaks. Pm Wiki automatically converts page text and metadata between encodings, but at the moment cannot automatically rename page files and attachments. If you already have international characters in file names (page names, uploads), after enabling UTF-8, review your wiki pages and links - you may need to rename some of the files on the server. Notes
This page may have a more recent version on pmwiki.org: PmWiki:UTF-8, and a talk page: PmWiki:UTF-8-Talk. |