ArticleslgStudy

science

Binary Ordered Compression for Unicode

Binary Ordered Compression for Unicode is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Binary Ordered Compression for Unicode rather than just read about it. In short: Binary Ordered Compression for Unicode (BOCU) is a MIME-compatible Unicode compression scheme. BOCU-1 combines the wide applicability of UTF-8 with the compactness of Standard Compression Scheme for Unicode (SCSU).

Key takeaways

  • Binary Ordered Compression for Unicode belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Binary Ordered Compression for Unicode to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Binary Ordered Compression for Unicode from memory before moving on to harder problems.

Reference excerpt

Binary Ordered Compression for Unicode (BOCU) is a MIME-compatible Unicode compression scheme. BOCU-1 combines the wide applicability of UTF-8 with the compactness of Standard Compression Scheme for Unicode (SCSU). This Unicode encoding is designed to be useful for compressing short strings, and maintains code point order. BOCU-1 is specified in a Unicode Technical Note. For comparison SCSU, was adopted as standard Unicode compression scheme with a byte-to-codepoint ratio similar to language-specific code pages. SCSU has not been widely adopted, as it is not suitable for MIME "text" media types. For example, SCSU cannot be used directly in emails and similar protocols. SCSU requires a complex encoder design for good performance. Usually, the zip, bzip2, and other industry-standard algorithms compact larger amounts of Unicode text more efficiently. Both SCSU and BOCU-1 are IANA registered charsets.

Details All numbers in this section are hexadecimal, and all ranges are inclusive. Code points from U+0000 to U+0020 are encoded in BOCU-1 as the corresponding byte value. All other code points (that is, U+0021 through U+D7FF and U+E000 through U+10FFFF) are encoded as a difference between the code point and a normalized version of the most recently encoded code point that was not an ASCII space (U+0020). The initial state is U+0040. The normalization mapping is as follows:

The difference between the current code point and the normalized previous code point is encoded as follows:

Each byte range is lexicographically ordered with the following thirteen byte values excluded: 00 07 08 09 0A 0B 0C 0D 0E 0F 1A 1B 20. For example, the byte sequence FC 06 FF, coding for a difference of 1156B, is immediately followed by the byte sequence FC 10 01, coding for a difference of 1156C. Any ASCII input U+0000 to U+007F excluding space U+0020 resets the encoder to U+0040. Because the above-mentioned values cover line end code points U+000D and U+000A as is (0D 0A), the encoder is in a known state at the beginning of each line. The corruption of a single byte therefore affects at most one line. For comparison, the corruption of a single byte in UTF-8 affects at most one code point, and for SCSU it can affect the entire document. BOCU-1 offers a similar robustness also for input texts without the above-mentioned values with the special reset code 0xFF. When a decoder finds this octet it resets its state to U+0040 as for a line end. The use of 0xFF reset bytes is not recommended in the BOCU-1 specification, because it conflicts with other BOCU-1 design goals, notably the binary order. The optional use of a signature U+FEFF at the begin of BOCU-1 encoded texts, i.e. the BOCU-1 byte sequence FB EE 28, changes the initial state U+0040 to U+FEC0. In other words, the signature cannot simply be stripped as in most other Unicode encoding schemes. Adding a reset byte after the signature (FB EE 28 FF) could avoid this effect, but the BOCU-1 specification does not recommend this practice. In theory UTF-1 and UTF-8 could encode the original UCS-4 set with 31 bits up to 7FFFFFFF. BOCU-1 and UTF-16 can encode the modern Unicode set from U+0000 to U+10FFFF. Excluding the thirteen protected code points encoded as single octets BOCU-1 can use 256−13=243 octets in multi-byte encodings. BOCU-1 needs at most four bytes consisting of a lead byte and one to three trail bytes. The trail bytes encode a remaining "modulo 243" (base 243) difference, the lead byte determines the number of trail bytes and an initial difference. The reset byte 0xFF is not protected and can occur as trail byte.

Patent Prior to 16 November 2022, the general BOCU algorithm was covered by United States Patent #6,737,994, which also mentions the specific BOCU-1 implementation. This patent has now expired. IBM, which employed both of the inventors of BOCU-1 at the time it was created, stated in the Unicode Technical Note that implementers of a "fully compliant version of BOCU-1" had to contact IBM to request a royalty-free license. BOCU-1 is the only Unicode compression scheme described on the Unicode Web site that is known to have been encumbered with intellectual property restrictions. By contrast, IBM also filed for a patent on UTF-EBCDIC, but it chose in that case to make the documentation and encoding scheme "freely available to anyone concerned towards making the transformation format as part of the UCS standards", instead of requiring implementers to request a license.

Not for HTML W3C and WHATWG HTML standards prohibit supporting BOCU-1 (and SCSU, CESU-8, UTF-7, EBCDIC, and UTF-32) in HTML documents because HTML was not 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.

References

See also UTF-1 contains a comparison of the UTF-1, UTF-8, and BOCU-1 designs International Components for Unicode A library that can convert between BOCU-1 and other Unicode encodings

Worked examples

Example 1 — a first encounter with Binary Ordered Compression for Unicode

Start with the simplest possible case. Write down what Binary Ordered Compression for Unicode claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Binary Ordered Compression for Unicode before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Binary Ordered Compression for Unicode ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Binary Ordered Compression for Unicode

In research
Binary Ordered Compression for Unicode appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Binary Ordered Compression for Unicode in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Binary Ordered Compression for Unicode is common in secondary-school and first-year university syllabi. It links to neighbouring topics Data compression, Unicode Transformation Formats, so understanding it makes those chapters shorter.
In everyday life
Look for Binary Ordered Compression for Unicode outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Binary Ordered Compression for Unicode” →

How to study Binary Ordered Compression for Unicode in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Binary Ordered Compression for Unicode means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Binary Ordered Compression for Unicode out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Binary Ordered Compression for Unicode in simple terms?

Binary Ordered Compression for Unicode (BOCU) is a MIME-compatible Unicode compression scheme. BOCU-1 combines the wide applicability of UTF-8 with the compactness of Standard Compression Scheme for Unicode (SCSU).

Why does Binary Ordered Compression for Unicode matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Binary Ordered Compression for Unicode?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Binary Ordered Compression for Unicode.

Tags

  • Data compression
  • Unicode Transformation Formats

Keep exploring