{"id":140,"date":"2012-09-15T11:43:00","date_gmt":"2012-09-15T15:43:00","guid":{"rendered":"http:\/\/www.dev-notes.com\/blog\/2012\/09\/15\/python-ucs2-vs-ucs4-installation\/"},"modified":"2012-09-15T11:43:00","modified_gmt":"2012-09-15T15:43:00","slug":"python-ucs2-vs-ucs4-installation","status":"publish","type":"post","link":"https:\/\/www.dev-notes.com\/blog\/2012\/09\/15\/python-ucs2-vs-ucs4-installation\/","title":{"rendered":"Python ucs2 vs ucs4 installation"},"content":{"rendered":"<p>For forcing ucs4 when installing Python:<\/p>\n<pre class=\"code\">\n.\/configure --enable-unicode=ucs4\nmake\nmake install\n<\/pre>\n<p><\/p>\n<p>For forcing ucs2 when installing Python:<\/p>\n<pre class=\"code\">\n.\/configure --enable-unicode=ucs2\nmake\nmake install\n<\/pre>\n<p><\/p>\n<p>Once you have it installed, a ucs4 version will produce the following:<\/p>\n<pre class=\"code\">\nbash$ python\nPython 2.5.2 (r252:60911, Mar  4 2008, 10:58:18)\n[GCC 3.4.5] on linux\n>>>import sys\n>>> print sys.maxunicode\n1114111\n<\/pre>\n<p>And, a ucs2 version will produce the following:<\/p>\n<pre class=\"code\">\n>>>import sys\n>>> print sys.maxunicode\n65535\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>On Linux, Python installations default to the unicode representation of the OS environment (ucs2 vs ucs4). I sometimes find myself needing to reinstall python, forcing a different unicode representation, especially when I am given pre-compiled python binaries.  Here are examples of using the &#8211;enable-unicode setting when building python. Also, there are some examples of how to determine which ucs setting your version of python is using.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-140","post","type-post","status-publish","format-standard","hentry","category-python"],"_links":{"self":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts\/140","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/comments?post=140"}],"version-history":[{"count":0,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts\/140\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/media?parent=140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/categories?post=140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/tags?post=140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}