PHP

Heard of the hype of ExpressionEngine for a while. Now it’s time to try.

ExpressionEngine is yet another PHP/MySQL CMS. It can do blogging and usual CMS job. From the comment I heard, ExpressionEngine is well known for its rich feature set and ease of use.

EE is not open source. Though the source code is visible and edible by PHP web application nature, you don’t have freedom to redistribute it like other free software.

The basic version called “ExpressionEngine Core” is free to download. The full version, with more features and tech support, is sold $99.95 for personal use and $249.95 for commercial user.

The following text is my note of trying EE Core on MAMP environment. Since the other CMS I’m only proficient is Drupal (this site is run by Drupal) so I will write it ‘in comparison’ with Drupal.

Unicode in PHP

วันนี้มีปัญหากับ Twiki เพราะมันตัด string ภาษาไทยเหลือนิดเดียว ในขณะที่ภาษาอังกฤษล้วนได้ยาวกว่าโข

ปัญหานี้เกิดกับโปรแกรมที่ใช้รหัสอักขระแบบ Unicode ซึ่งรวม SMS ในมือถือด้วย

การเข้ารหัสตัวอักษรแบบ UTF-8 นั้นจะให้ตัวละติน 128 ตัวแรกตาม ASCII ใช้แค่ 1 byte (โดยให้เหตุผลว่าเป็นตัวที่ใช้บ่อย) ส่วนที่เหลือจะใช้ 3 byte (Basic Multilingual Plane ภาษาไทยอยู่ในหมวดนี้) และตัวอักษรพิสดาร เช่น ตัวจีนแบบที่ไม่ค่อยมีคนใช้ (Supplementary Multilingual Plane) จะนับ 4 byte (อ่าน: UTF-8, Mapping of Unicode characters)

Note: Unicode มีการเข้ารหัสอีกหลายแบบ (เช่น UTF-16) เพียงแต่ UTF-8 ได้รับความนิยมสูงสุดในการแลกเปลี่ยนข้อมูลระหว่างโปรแกรม (UTF-16 นิยมใช้ภายในโปรแกรม)

สำหรับ CMS อย่าง Twiki หรือ Drupal คงจะโทษตัว CMS ไม่ได้ เพราะสาเหตุมาจาก PHP5 ไม่สนับสนุน Unicode แบบ native (อ่าน) ต้องใช้ MBString extension เข้าช่วย

ปัญหานี้จะถูกแก้ไขใน PHP6 (อ่าน) ประเด็นสำคัญๆ ก็อย่างการเปิด Unicode on เป็น default, การผนวก ICU เข้ามา (สำหรับตัดคำและงานอื่นๆ) หรือไม่ เป็นต้น