Error getting tags :
error 404Error getting tags :
error 404 uniDecode | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Version
uniDecode
Basics
Expander triangle
Type
Function
Syntax

the uniDecode of stringToDecode uniDecode(stringToDecode[,language])

Introduced
1.0
Changed
2.1.1
Environment
Desktop, Web and Server
Platform Support
MacOS,Mac OS X,Windows,Linux
Security
None required
Summary
Converts a string from Unicode to single-byte text.
Examples

uniDecode("A" & numToChar(zero)) -- returns "A" (on PPC)
uniDecode("ABCDE") -- returns "BD" (on Intel)
uniDecode(field "JIS Input","Japanese") -- converts to JIS

Additional Comments
Expander triangle

Use the uniDecode function to convert double-byte characters to single-byte characters.

Parameters:

The stringToDecode is any string, or expression that evaluates to a string.

The language is one of the following:

* ANSI (synonym for "English")

* Arabic

* Bulgarian

* Chinese

* English

* Greek

* Hebrew

* Japanese (Shift-JIS)

* Korean

* Polish

* Roman

* Russian (Cyrillic)

* Thai

* Turkish

* SimpleChinese (Simplified Chinese)

* Ukrainian

* Unicode (UTF-16)

* UTF8

* w (synonym for "Unicode")

Value:

If you don't specify a language, the uniDecode function returns the stringToDecode, with every second byte removed.

If a language is specified, the uniDecode function encodes the stringToDecode into single-byte text, using the appropriate method for the specified language.

Comments:

The uniDecode function is the inverse of the uniEncode function and removes the null bytes inserted for Unicode compatibility. In other words, it turns double-byte characters into their closest single-byte equivalent.

If the stringToDecode contains an odd number of bytes, the last byte is ignored.

Note: You can use the UTF8 encoding only with the uniDecode and uniEncodefunctions. You cannot set an object'stextFontproperty to use UTF-8. To display Unicode text in an object, use either "Unicode" or a language name as the second item of the object'stextFont.

Important! The format expected by the uniDecodefunction is processor-dependent. On "little-endian" processors, where the first byte is least significant (such as Intel and Alpha processors), the uniDecodefunction removes the second byte of each character. On "big-endian" processors, where the last byte is least significant (such as PowerPC processors), the uniDecodefunction removes the first byte of each character.

Changes to Revolution:

The ability to encode text in Polish was added in version 2.1.1.

The ability to handle double-byte characters on "little-endian" processors was added in version 2.0. In previous versions, the uniDecode function always removed the second byte of each pair of bytes, regardless of platform.

The ability to convert Unicode text into language-specific encodings was added in version 2.0. In previous versions, the uniDecode function simply removed every other byte.

User Comments
Expander triangle
User thumbnail
Devin Asay
StarStarStarStarStar
Apr 9, 2009
Here is how to save unicode text as UTF-8 encoded file:


get the unicodeText of fld "myUniText"
put uniDecode(it,"utf8") into url "binfile:/path/to/file/myUniFile.ut8"