1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-18 03:19:55 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/filters/jsonstringify Operator.tid
Robin Munn 8ffe138942
Add rawunicode suffix to (json)stringify operators (#5191)
Default with no suffix is pre-5.1.23 behavior, escaping all Unicode
characters for maximum compatibility (avoids encoding issues). New
"rawunicode" suffix allows passing through Unicode characters U+0080
and up unchanged, for cases where you know your tools are handling
encoding correctly and you want less verbose escaping.
2020-12-04 13:19:59 +00:00

37 lines
1.6 KiB
Plaintext

caption: jsonstringify
created: 20171029155051467
from-version: 5.1.14
modified: 20171029155143797
op-input: a [[selection of titles|Title Selection]]
op-output: the input with JSON string encodings applied
op-parameter:
op-parameter-name:
op-purpose: apply JSON string encoding to a string
op-suffix: <<.from-version "5.1.23">> optionally, the keyword `rawunicode`
op-suffix-name: R
tags: [[Filter Operators]] [[String Operators]]
title: jsonstringify Operator
type: text/vnd.tiddlywiki
The following substitutions are made:
|!Character |!Replacement |!Condition |
|`\` |`\\` |Always |
|`"` |`\"` |Always |
|Carriage return (0x0d) |`\\r` |Always |
|Line feed (0x0a) |`\\n` |Always |
|Backspace (0x08) |`\\b` |Always |
|Form field (0x0c) |`\\f` |Always |
|Tab (0x09) |`\\t` |Always |
|Characters from 0x00 to 0x1f |`\\u####` where #### is four hex digits |Always |
|Characters from 0x80 to 0xffff|`\\u####` where #### is four hex digits |If `rawunicode` suffix is not present (default) |
|Characters from 0x80 to 0xffff|Unchanged |If `rawunicode` suffix is present <<.from-version "5.1.23">> |
<<.from-version "5.1.23">> If the suffix `rawunicode` is present, Unicode characters above 0x80 (such as ß, ä, ñ or 🎄) will be passed through unchanged. Without the suffix, they will be substituted with `\\u` codes, which was the default behavior before 5.1.23.
<<.note """Technical note: Characters outside the Basic Multilingual Plane, such as 🎄 and other emojis, will be encoded as a UTF-16 surrogate pair, i.e. with two `\u` sequences.""">>
Also see the [[stringify Operator]].
<<.operator-examples "jsonstringify">>