Changes for page UTF-8 Encoding Tips
Last modified by Ray Kiddy on 2022/01/11 21:36
From version 18.1
edited by Ramsey Gurley
on 2013/06/12 13:30
on 2013/06/12 13:30
Change comment:
There is no comment for this version
To version 7.1
edited by Antoine Berry
on 2012/09/20 10:32
on 2012/09/20 10:32
Change comment:
Migrated to Confluence 4.0
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. ramsey1 +XWiki.aberry - Content
-
... ... @@ -7,6 +7,7 @@ 7 7 The database needs to be storing values in UTF-8. If it isn't, then all your effort is wasted. For example, on MySQL that means a db url like 8 8 9 9 {{noformat}} 10 + 10 10 jdbc:mysql://localhost/Example?capitalizeTypenames=true&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8 11 11 12 12 {{/noformat}} ... ... @@ -20,6 +20,7 @@ 20 20 Different fonts may not have all the characters to display the different characters. If you're using a default stylesheet, then the browsers may be displaying differently simply because of fonts. Speaking of stylesheets, you probably want to encode that in UTF-8 also. Start your stylesheet with something like 21 21 22 22 {{noformat}} 24 + 23 23 @charset "UTF-8"; 24 24 @import url("reset.css"); 25 25 ... ... @@ -36,6 +36,7 @@ 36 36 I think this goes without saying but: **Use Wonder**. Set encoding in the properties file. Notice it is UTF-8 with a hyphen. It it always UTF-8 with a hyphen... well, except with the MySQL image above because they excel in doing things differently 37 37 38 38 {{noformat}} 41 + 39 39 # Project Encoding 40 40 er.extensions.ERXApplication.DefaultEncoding=UTF-8 41 41 ... ... @@ -44,6 +44,7 @@ 44 44 == Set encoding in your page wrapper == 45 45 46 46 {{noformat}} 50 + 47 47 <?xml version="1.0" encoding="UTF-8" standalone="no"?> 48 48 <!DOCTYPE html PUBLIC 49 49 "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" ... ... @@ -53,7 +53,7 @@ 53 53 54 54 == Localizable strings should be in UTF-16! == 55 55 56 -Localizable.strings should be encoded in UTF-16. The localizer can detect UTF-16 without error, where it can confuse UTF-8 with other encodings. Specifically,youshouldbeusingUTF-16BE withnoBOMif you are using an externaltext editorinstead of eclipse.60 +Localizable.strings should be encoded in UTF-16. The localizer can detect UTF-16 without error, where it can confuse UTF-8 with other encodings. Pascal says use UTF-16LE if you want to be explicit about things... Especially if you are editing your strings files in an external editor like BBEdit or whatnot. I use the eclipse editor and UTF-16 myself and all seems to work fine for me. So to each his own. 57 57 58 58 == Build your files in UTF-8. == 59 59 ... ... @@ -60,6 +60,7 @@ 60 60 If you have some special characters in your code (like '€' for exemple), then you will need to specify which encoding you want when you build your application. To do that, you have to modify your "build.xml" file by adding the property "encoding="utf-8" into your <wocompile> statement. 61 61 62 62 {{code language="xml"}} 67 + 63 63 <wocompile srcdir="Sources" destdir="bin" encoding="utf-8"> 64 64 65 65 {{/code}}