Application Development Tips and Tricks > Application design and development > Writing double-byte applications

 

Writing double-byte applications

If you are using server-side ActionScript in a development environment or language kit that facilitates double-byte text (such as an Asian language character set), your server-side ActionScript must be in an ASC file that has been UTF-8-encoded. This means you'll need a JavaScript editor, such as Macromedia Dreamweaver MX, that encodes files to the UTF-8 standard. Then, you can use built-in JavaScript methods such as Date.toLocaleString, which converts the string to the locale encoding for that system.

Tip: Some simple text editors might not encode files to the UTF-8 standard; Microsoft Windows Notepad for Windows XP and Windows 2000 provides a Save As option to encode files to the UTF-8 standard.

To ensure UTF-8 encoding, in Dreamweaver MX, you'll need to change two settings: the document encoding setting and the inline input setting.

To change the document encoding setting, select Modify > Page Properties, then select Document Encoding. Choose Other to create a document with the encoding your operating system is using.

To change the inline input setting, choose Edit > Preferences or Dreamweaver > Preferences (Mac OS X), and then click General. Select Enable Double-Byte Online Input to enable to enter double-byte text.

To use double-byte characters as method names, the method names must be assigned using the object array operator and not the dot operator:

// This is the CORRECT way to create double-byte method names
obj["Any_hi_byte_name"] = function(){} 

// This is the INCORRECT way to create double-byte method names
obj.Any_hi_byte_name = function() {}