diff options
| author | Dan Gohman <sunfish@mozilla.com> | 2017-03-30 09:33:19 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-03-30 09:33:19 -0700 |
| commit | 8e5ecc3614135a7da011cc4730e227fcb9021494 (patch) | |
| tree | aa8777aef224a682aa23719d7d774a3a7204174e /BinaryEncoding.md | |
| parent | d9bff35e1389ba11c98ccee8cde72bb2f30e922c (diff) | |
| download | nanowasm-design-8e5ecc3614135a7da011cc4730e227fcb9021494.tar.gz | |
Require import/export names to be UTF-8. (#1016)
* Require import/export names to be UTF-8.
This implements the UTF-8 proposal described in
https://github.com/WebAssembly/design/issues/989#issuecomment-284757788.
This does not currently rename "name" to "utf8-name", because if UTF-8 is
required for import/export names, there's a greater appeal to just saying
that all strings are UTF-8, though this is debatable.
* s/utf8/UTF-8/g
* Say "UTF-8 byte sequence" rather than "UTF-8 string".
This document is describing the encoded bytes, rather than the string which
one gets from decoding them.
Also, make the descriptions of the byte sequence length fields more precise.
* Fix typo.
Diffstat (limited to 'BinaryEncoding.md')
| -rw-r--r-- | BinaryEncoding.md | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/BinaryEncoding.md b/BinaryEncoding.md index 36db43f..f131551 100644 --- a/BinaryEncoding.md +++ b/BinaryEncoding.md @@ -195,8 +195,8 @@ part of the payload. | ----- | ----- | ----- | | id | `varuint7` | section code | | payload_len | `varuint32` | size of this section in bytes | -| name_len | `varuint32` ? | length of the section name in bytes, present if `id == 0` | -| name | `bytes` ? | section name string, present if `id == 0` | +| name_len | `varuint32` ? | length of `name` in bytes, present if `id == 0` | +| name | `bytes` ? | section name: valid UTF-8 byte sequence, present if `id == 0` | | payload_data | `bytes` | content of this section, of length `payload_len - sizeof(name) - sizeof(name_len)` | Each known section is optional and may appear at most once. Custom sections all have the same `id` (0), and can be named non-uniquely (all bytes composing their names may be identical). @@ -252,10 +252,10 @@ The import section declares all imports that will be used in the module. | Field | Type | Description | | ----- | ---- | ----------- | -| module_len | `varuint32` | module string length | -| module_str | `bytes` | module string of `module_len` bytes | -| field_len | `varuint32` | field name length | -| field_str | `bytes` | field name string of `field_len` bytes | +| module_len | `varuint32` | length of `module_str` in bytes | +| module_str | `bytes` | module name: valid UTF-8 byte sequence | +| field_len | `varuint32` | length of `field_str` in bytes | +| field_str | `bytes` | field name: valid UTF-8 byte sequence | | kind | `external_kind` | the kind of definition being imported | Followed by, if the `kind` is `Function`: @@ -355,8 +355,8 @@ The encoding of the [Export section](Modules.md#exports): | Field | Type | Description | | ----- | ---- | ----------- | -| field_len | `varuint32` | field name string length | -| field_str | `bytes` | field name string of `field_len` bytes | +| field_len | `varuint32` | length of `field_str` in bytes | +| field_str | `bytes` | field name: valid UTF-8 byte sequence | | kind | `external_kind` | the kind of definition being exported | | index | `varuint32` | the index into the corresponding [index space](Modules.md) | @@ -470,8 +470,8 @@ where a `naming` is encoded as: | Field | Type | Description | | ----- | ---- | ----------- | | index | `varuint32` | the index which is being named | -| name_len | `varuint32` | number of bytes in name_str | -| name_str | `bytes` | binary encoding of the name | +| name_len | `varuint32` | length of `name_str` in bytes | +| name_str | `bytes` | UTF-8 encoding of the name | #### Function names |
