History & use
Reuters originally developed SCSU, then under the name RSCU for Reuters Compression Scheme for Unicode. At first the Unicode Consortium considered it to be a character encoding, but in 1999 changed its mind: although it was still considered a transfer encoding syntax, for a while it was no longer considered a character encoding because different compressors might yield different outputs for the same text. However, in 2004 this decision was reverted and now SCSU is considered a ''compressing'' character encoding scheme, as opposed to a simple or compound character encoding scheme. Roman Czyborra (ofThe scheme
The following sections briefly describe the anatomy of a compressed SCSU stream. For a full description (matching that of a decompressor), see the UTS #6 document.Encoding modes
SCSU starts in the single-byte mode, which uses the compressed Window encoding. There exist commands to switch to a UTF-16BE "Unicode" mode, and to switch to the single-byte mode from that mode.Window encoding
The core of SCSU lies in the windows for which the meanings of bytes 0x80-0xff are defined. There are eight static windows for simpler scripts and punctuation, and 6 types of dynamic windows (plus "half Unicode block" windows and custom Windows for the supplementary planes) for scripts making use of more characters. Both simple and dynamic windows are selected by special command characters. For individual characters that do not fit into the current block, command characters for quoting are provided.Comparison with general-purpose plain text compression schemes
Because UTF-16 or UTF-8 text might occupy more space than its equivalent in pre-Unicode encodings did, one might want to use compression such as SCSU to mitigate this problem. In comparison with general-purpose compressors, it is not necessarily advantageous to use SCSU. Also, while it can be used as a text encoding, because of the stateful nature of the algorithm difficulties may arise when using it as an internal text representation since basic text operations become non-trivial. Treated purely as a compression algorithm, SCSU is inferior to most commonly used general-purpose algorithms for texts of over a few kilobytes. SCSU does have the advantage that it can usefully compress texts that are only a few characters long, whereas most full-scale compressors need hundreds of bytes of data to break even against their own overhead. In Symbian OS, SCSU is used even for Clipboard operations, e.g. Cut, Copy & Paste of small strings of text.In HTML
Supporting SCSU in HTML documents is prohibited by the W3C and WHATWG HTML standards because HTML wasn't designed with non-ASCII-compatible encodings in mind. In the past, cross-site scripting vulnerabilities due to browsers' poor handling of such encodings have been demonstrated.See also
* Binary Ordered Compression for Unicode (BOCU-1) * International Components for Unicode A library that can convert between SCSU and other Unicode encodingsReferences