Get Smarty

Donate

Donate Bitcoin Bitcoin
Paypal

Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Sites Using Smarty

Buy cheap eyeglasses from Cheapglasses123.com and save up to 80%.

Buy prescription glasses from www.australiaglasses.com and save.

Cheap Glasses Now On Sale at GlassesPeople.com. Starts At $7.95.

Where to buy discount wedding dresses and cheap smart dresses free shipping - Weddingdresstrend.com

Brautkleider auf Topwedding.de

Find free files to download on allwhatyouwant.net

Looking For Affordable Wedding Dresses 2015 at Best Prices On TDBridal.com

Shop high quality cheap prom dresses on Dresswe.co.uk

Buy New Arrival Cheap Prom Dresses 2015 at JDBRIDAL Prom Dress Store

Advertisement

Chapter 11. 字符集编�

字符集编�

有许多�文本数�的编�方�,ISO-8859-1 (Latin1) 和 UTF-8 是最常�的。 除�明确声明SMARTY_RESOURCE_CHAR_SET使用的字符集,默认 Smarty当�到多字节字符情况 会使用UTF-8作为内置的字符集, 而当没有多字节字符情况下使用ISO-8859-1。

Note

ISO-8859-1从开始就是PHP内置的默认字符集。 Unicode从1991年开始演�而�,而且��替代了其他的字符集,因为其能对大多数已知的字符进行编�, 而且�到了跨����字符集的系统(latin, cyrillic, japanese, …)。 UTF-8是unicode中使用的最多的编�,它�以用最�的尺寸�供��上万的字符。

现在unicode和UTF-8已��常�行了,所以强烈建议使用它们。

Note

从Smarty3.1开始,Smarty核心类和�件都被设计�兼容UTF-8的。 ��到良好的兼容性,最好开�多字节字符的PECL库。 除�PHP环境�以�供这个库,Smarty将�一定能完整兼容UTF-8。

Example 11.1. 设置字符集编�


// 使用日文字符集编�
if (function_exists('mb_internal_charset')) {
  mb_internal_charset('EUC-JP');
}
define('SMARTY_RESOURCE_CHAR_SET', 'EUC-JP');
require_once 'libs/Smarty.class.php';
$smarty = new Smarty();
  
 

Comments
No comments for this page.
Post a Comment
All comments are moderated. Support questions are ignored, use the forums instead.
Author:
Email: (not shown)
What is 5 plus 1? (Are you human?)

Advertisement