2016-10-18 08:18:32 +00:00
caption: stringify
created: 20161017153038029
2023-09-19 14:52:04 +00:00
from-version: 5.1.14
2023-11-29 09:01:46 +00:00
modified: 20230922121406947
2016-10-18 08:18:32 +00:00
op-input: a [[selection of titles|Title Selection]]
op-output: the input with ~JavaScript string encodings applied
op-parameter:
op-parameter-name:
2023-11-29 09:01:46 +00:00
op-purpose: apply ~JavaScript string encoding to a string, see also the similar <<.olink jsonstringify>>
2020-12-04 13:19:59 +00:00
op-suffix: <<.from-version "5.1.23">> optionally, the keyword `rawunicode`
op-suffix-name: R
2016-10-18 08:18:32 +00:00
tags: [[Filter Operators]] [[String Operators]]
title: stringify Operator
type: text/vnd.tiddlywiki
2017-10-31 17:25:21 +00:00
The following substitutions are made:
2020-12-04 13:19:59 +00:00
|!Character |!Replacement |!Condition |
|`\` |`\\` |Always |
|`"` |`\"` |Always |
2023-11-29 09:01:46 +00:00
|`'` |`\'` |Always |
2023-09-19 14:52:04 +00:00
|Line feed (0x0a) |`\n` |Always |
2023-11-29 09:01:46 +00:00
|Carriage return (0x0d) |`\r` |Always |
|Characters from 0x00 to 0x1f, except listed above |`\x##` where ## is two hex digits |Always |
2023-09-19 14:52:04 +00:00
|Characters from 0x80 to 0xffff|`\u####` where #### is four hex digits |If `rawunicode` suffix is not present (default) |
2020-12-04 13:19:59 +00:00
|Characters from 0x80 to 0xffff|<<.from-version "5.1.23">> Unchanged |If `rawunicode` suffix is present |
2023-11-29 09:01:46 +00:00
<<.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. 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.
2017-10-31 17:25:21 +00:00
2023-11-29 09:01:46 +00:00
<<.note """Mind the differences compared to <<.olink jsonstringify>> in encoding of single quotes and control characters (0x00 to 0x1f).
""">>
2017-10-31 17:25:21 +00:00
2023-09-19 14:52:04 +00:00
<<.operator-examples "stringify">>