Content deleted Content added
→Comparison with general-purpose plain text compression schemes: See Talk page. |
Kalinovcic (talk | contribs) m Fix incorrect capitalization |
||
(36 intermediate revisions by 17 users not shown) | |||
Line 1:
{{Short description|Unicode Technical Standard}}
{{expand German|date=August 2013}}
The '''Standard Compression Scheme for Unicode''' (SCSU)<ref>{{cite web |url=
==History & use ==
[[Symbian OS]], an operating system for mobile phones and other mobile devices, uses SCSU to serialise strings.▼
[[Reuters]] originally developed SCSU, then under the name RCSU for Reuters Compression Scheme for Unicode.<ref>{{Cite web|url=https://unicode.org/iuc/iuc9/Friday2.html#b3|title = Ninth International Unicode Conference - Friday - Track B}}</ref><ref>{{Cite web|url=https://unicode.org/iuc/iuc10/program.html|title=Tenth International Unicode Conference - Conference Program}}</ref><ref>{{Cite web|url=https://unicode.org/reports/tr6-10.html|title=Compression Scheme for Unicode}}</ref><ref name=Ewellic>{{Cite web|url=https://www.unicode.org/notes/tn14/UnicodeCompression.pdf|title = A survey of Unicode compression}}</ref>
At first the Unicode Consortium considered it to be a character encoding,<ref>{{Cite web|url=https://unicode.org/reports/tr17/tr17-2.html|title = UTR#17: Character Encoding Model}}</ref> 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.<ref>https://unicode.org/reports/tr17/tr17-3.html#Transfer Encoding Syntax</ref> 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.<ref>{{Cite web|url=https://unicode.org/L2/L2004/04288-tr17-5d2.html#CharacterEncodingScheme|title=UTR#17: Character Encoding Model|date=2004-07-14}}</ref><ref>{{Cite web |title=UTR#17: Unicode Character Encoding Model |url=https://unicode.org/reports/tr17/ |access-date=2023-11-14 |website=unicode.org}}</ref>
Roman Czyborra (of [[GNU Unifont]]) wrote a decompressor.<ref>{{Cite web| title=This is a deflator to UTF-8 output for input compressed in SCSU | url=https://czyborra.com/scsu/scsu.c | archive-url=https://web.archive.org/web/19990908230458/http://czyborra.com:80/scsu/scsu.c | archive-date=1999-09-08}}</ref> The IBM-contributed decompressor is found in [[International Components for Unicode]], along with a compressor written in Java.<ref>{{Cite web|url=https://github.com/unicode-org/icu/blob/3f043c7693e20c8cded76035918dad104e7256e3/icu4j/main/classes/charset/src/com/ibm/icu/charset/CharsetSCSU.java|title = International Components for Unicode|website = [[GitHub]]|date = 22 October 2021}}</ref> Simpler reference codecs are available as attachments to TR6.
[[Microsoft SQL Server|SQL Server 2008 R2]] uses SCSU to compress Unicode values stored in ''nchar(n)'' and ''nvarchar(n)'' columns, achieving space savings between 15% and 50%, depending on the language of the data.<ref>{{cite web|url=http://msdn.microsoft.com/en-us/library/ee240835(SQL.105).aspx|title=Unicode Compression Implementation (SQL Server 2008 R2 Books Online)|accessdate=2008-08-18}}</ref>▼
▲[[Symbian OS]], an operating system for mobile phones and other mobile devices, uses SCSU to
== Comparison with general-purpose plain text compression schemes ==▼
▲[[Microsoft SQL Server|SQL Server 2008 R2]] uses SCSU to compress Unicode values (there meaning from strings in [[UCS-2]] encoding) stored in ''nchar(n)'' and ''nvarchar(n)'' columns, achieving space savings between 15% and 50% (while [[UTF-8]] only has this 50% reduction for [[ASCII]] subset of Unicode), depending on the language of the data.<ref>{{cite web|url=
== The 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.<ref>{{Cite web| title=Implementation Guidelines | url=https://unicode.org/versions/Unicode3.0.0/ch05.pdf | archive-url=https://web.archive.org/web/20150730234318/http://www.unicode.org/versions/Unicode3.0.0/ch05.pdf | archive-date=2015-07-30}}</ref> In comparison with general-purpose compressors, it is not necessarily advantageous to use SCSU.<ref name=Ewellic/> 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.
Line 16 ⟶ 32:
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.
==
Supporting SCSU in [[HTML]] documents is prohibited by the [[W3C]]<ref>{{Cite web |url=https://www.w3.org/TR/html51/syntax.html#character-encodings |title=8.2.2.3. Character encodings |website=HTML 5.1 Standard |publisher=W3C}}</ref><ref>{{Cite web |url=https://www.w3.org/TR/html5/syntax.html#character-encodings |title=8.2.2.3. Character encodings |website=HTML 5 Standard |publisher=W3C}}</ref> and [[WHATWG]]<ref>{{Cite web |url=https://html.spec.whatwg.org/multipage/parsing.html#character-encodings |title=12.2.3.3 Character encodings |website=HTML Living Standard |publisher=WHATWG}}</ref> 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.<ref>{{Cite web |url=https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta |title=<meta> - HTML |website=MDN Web Docs |publisher=Mozilla|archiveurl=https://web.archive.org/web/20181003090922/https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta|archivedate=3 October 2018}}</ref>
== See also ==
* [[Binary Ordered Compression for Unicode]] (BOCU-1)
* [[International Components for Unicode]] A library that can convert between SCSU and other Unicode encodings
Line 24 ⟶ 44:
{{Unicode navigation}}
{{
{{DEFAULTSORT:Standard Compression Scheme For Unicode}}
|