Blame
Date:
Sun Oct 2 04:00:24 2022
UTC
Message:
Daily backup
7
2021-12-17
targets=PmWiki.Internationalizations,PmWiki.Upgrades,PmWiki.I18nVariables,PmWiki.LayoutVariables,Skins.Amber,PmWiki.LocalCustomizations,Cookbook.UTF-8
8
2021-12-17
text=Summary: Enabling UTF-8 Unicode language encoding in your wiki. %0a%0aUTF-8 supports all languages and alphabets, including Asian languages and their character depth. It is a widely supported and flexible character encoding. %0a%0aIt's fairly simple to enable UTF-8 on your wiki pages. Current PmWiki versions have the UTF-8 file which is enabled by default in the sample-config.php.%0a%0a!! Enabling UTF-8 on a new wiki%0a%0aIf you start a new wiki in any language with the latest PmWiki version, it is highly recommended to enable UTF-8. In the future, PmWiki 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.%0a%0aTo enable UTF-8 for a new wiki, add this line near the beginning of config.php (the docs/sample-config.php file has this line already):%0a%0a include_once("scripts/xlpage-utf-8.php");%0a%0aThis line should come ''before'' a call to the XLPage() function in [[internationalizations|international wikis]].%0a%0aSave your config.php file encoded as UTF-8 (NO BOM). That allows entry of UTF-8 encoded characters in it. Make sure your editor does support this, and test by adding some non-ANSI UTF-8 characters, to see them in the text editor '^[[#notes|1]]^'.%0a%0aWith 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. %0a%0a!! Enabling UTF-8 on existing wikis%0a%0aCurrently, this is possible ''only if your group and page ''names'', as well as upload names, don't contain international characters''. The names of wiki pages are used as file names, and we don't have yet an easy way to rename the disk files.%0a%0aIf your wiki doesn't have international page/file names, first [[upgrade(s)]] to the latest PmWiki version. To enable UTF-8, add these lines near the beginning of config.php:%0a%0a include_once("scripts/xlpage-utf-8.php");%0a [=$DefaultPageCharset=] = array(''=>'ISO-8859-1'); # see below%0a%0aThese lines should come ''before'' a call to the XLPage() function in [[internationalizations|international wikis]].%0a%0aThe $DefaultPageCharset line is there to fix and correctly handle some pages with missing or wrong attributes, created by older PmWiki versions.%0a%0a* Most wikis in European languages are likely to be in the ISO-8859-1 encoding and should use:\\%0a @@$DefaultPageCharset = array(''=>'ISO-8859-1');@@%0a* Wikis in Czech and Hungarian language are likely to be in the ISO-8859-2 encoding, they should use this line instead:\\%0a @@ $DefaultPageCharset = array(''=>'ISO-8859-2', 'ISO-8859-1'=>'ISO-8859-2'); @@%0a* Wikis in Turkish language are likely to be in the ISO-8859-9 encoding, they should use this line instead:\\%0a @@ $DefaultPageCharset = array(''=>'ISO-8859-9', 'ISO-8859-1'=>'ISO-8859-9'); @@%0a%0a%0aYou should also delete the file @@ wiki.d/.pageindex@@. This file contains a cache of links and words from your pages and is used for searches and pagelists. PmWiki will rebuild it automatically with the new encoding.%0a%0a!!Support for RTL right-to-left languages%0aLanguages 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: %0a(:markup:)%0a>>rtl%3c%3c%0aيتدفق هذا النص من اليمين إلى اليسار%0a>>ltr%3c%3c%0aThis text flows left to right.%0a>>%3c%3c%0a(:markupend:)%0a%0aTo set text direction for a wiki generally to RTL, you could add to config.php a line like:%0a%0a $HTMLStylesFmt['rtl'] = " body { direction:rtl; }"%0a%0abut the skin you use may need other modifications, for instance to swap the search box and the page actions to the other side etc. %0a%0aSome skins have full support for RTL, see for instance [[Skins:Amber|Amber]]. %0a%0a[[#notes]]%0a!! Notes%0a* You need to save your config.php file in the UTF-8 encoding, and "Without Byte Order Mark (BOM)". See [[LocalCustomizations#encoding|Character encoding of config.php]].%0a%0a* This page concerns the most recent versions of PmWiki. See [[Cookbook:UTF-8]] for tips on older versions.%0a%0a* In the case your PmWiki installation displays wrong encoding, or save an UTF-8 page to an other encoding without explanation, you can double check your custom .htaccess settings at the root of your served pages.%0a %0a