From b579018b406d7752f8b7a3aa9c2bc800519c6f1a Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Wed, 25 Apr 2018 14:22:45 +0200 Subject: [PATCH] Give clearer advice on hooks for standards Fixes #125. --- encoding.bs | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/encoding.bs b/encoding.bs index edc8962..068f964 100644 --- a/encoding.bs +++ b/encoding.bs @@ -842,14 +842,25 @@ different format here, to be able to represent ranges.) -

Specification hooks

- -

The algorithms decode, UTF-8 decode, -UTF-8 decode without BOM, UTF-8 decode without BOM or fail, -encode, and UTF-8 encode are intended for usage by other specifications. -UTF-8 decode is to be used by new formats. The -get an encoding algorithm can be used first to turn a -label into an encoding. +

Hooks for standards

+ +
+

The algorithms defined below (decode, UTF-8 decode, + UTF-8 decode without BOM, UTF-8 decode without BOM or fail, encode, and + UTF-8 encode) are intended for usage by other standards. + +

For decoding, UTF-8 decode is to be used by new formats. For identifiers or byte + sequences within a format or protocol, use UTF-8 decode without BOM or + UTF-8 decode without BOM or fail. + +

For encoding, UTF-8 encode is to be used. + +

Standards are strongly discouraged from using decode and encode, except as + needed for compatibility. + +

The get an encoding algorithm is to be used to turn a label into an + encoding. +

To decode a byte stream stream using fallback encoding encoding, run these steps: