Lines Matching +full:ascii +full:- +full:based
3 .. _field-formatting:
6 ----------------
9 use varies based on the role of the field, but generally is used to
15 Note a field definition can contain zero or more printf-style
22 '%' format-modifier * format-character
24 The format-modifier can be:
26 - a '#' character, indicating the output value should be prefixed
28 - a minus sign ('-'), indicating the output value should be padded on
30 - a leading zero ('0') indicating the output value should be padded on the
32 - one or more digits ('0' - '9') indicating the minimum width of the
35 - a period followed by one or more digits indicating the maximum
37 width for a non-string argument. When handling ASCII strings this
38 functions as the field width but for multi-byte characters, a single
41 - a second period followed by one or more digits indicating the maximum
42 width for a string argument. This modifier cannot be given for non-string
44 - one or more 'h' characters, indicating shorter input data.
45 - one or more 'l' characters, indicating longer input data.
46 - a 'z' character, indicating a 'size_t' argument.
47 - a 't' character, indicating a 'ptrdiff_t' argument.
48 - a ' ' character, indicating a space should be emitted before
50 - a '+' character, indicating sign should emitted before any number.
69 e double [-]d.ddde+-dd
70 E double [-]d.dddE+-dd
71 f double [-]ddd.ddd
72 F double [-]ddd.ddd
75 a double [-]0xh.hhhp[+-]d
76 A double [-]0Xh.hhhp[+-]d
79 s char \* a UTF-8 string
100 .. index:: UTF-8
103 .. _utf-8:
105 UTF-8 and Locale Strings
110 pointer to a string encoded as UTF-8. Since UTF-8 is compatible with
111 ASCII data, a normal 7-bit ASCII string can be used. '%ls' expects a
112 'wchar_t \*' pointer to a wide-character string, encoded as a 32-bit
113 Unicode values. '%hs' expects a 'char \*' pointer to a multi-byte
117 defaults to "UTF-8".
119 libxo will convert these arguments as needed to either UTF-8 (for XML,
120 JSON, and HTML styles) or locale-based strings for display in text
123 xo_emit("All strings are utf-8 content {:tag/%ls}",
129 %s const char \* UTF-8 string
130 %S const char \* UTF-8 string (alias for '%ls')
132 %hs const char * locale-based string
138 It is not "*locale*", a common mis-mnemonic. "%S" is equivalent to
141 For example, the following function is passed a locale-base name, a
142 hat size, and a time value. The hat size is formatted in a UTF-8
143 (ASCII) string, and the time value is formatted into a wchar_t
161 xo_emit("It was ordered on {:order-time/%ls}.\n",
168 UTF-8.
170 UTF-8 and locale-encoded strings can use multiple bytes to encode one
171 column of data. The traditional "precision'" (aka "max-width") value
201 <div class="data" data-tag="size">extra small</div>
237 .. index:: printf-like
242 Many compilers and tool chains support validation of printf-like
246 these checks can still provide build-time protection against bugs.
249 "--enable-printflike" option is passed to the "configure" script.
254 incompatible with printf-like testing:
256 - implicit formats, where "{:tag}" has an implicit "%s";
257 - the "max" parameter for strings, where "{:tag/%4.10.6s}" means up to
260 - percent signs in strings, where "{:filled}%" makes a single,
262 - the "l" and "h" modifiers for strings, where "{:tag/%hs}" means
263 locale-based string and "{:tag/%ls}" means a wide character string;
264 - distinct encoding formats, where "{:tag/#%s/%s}" means the display
271 Function printf-like Equivalent
301 xo_emit_f(XOEF_RETAIN, "{:some/%02d}{:thing/%-6s}{:fancy}\n",
307 argument, and printf-like flags):
337 The retained information is kept as thread-specific data.
344 xo_emit("{P: }{Lwc:In stock}{:in-stock/%u}\n",
352 <in-stock>144</in-stock>
354 "in-stock": 144,
361 <div class="data" data-tag="in-stock">144</div>
368 <div class="data" data-tag="in-stock"
369 data-xpath="/top/data/item/in-stock"
370 data-type="number"
371 data-help="Number of items in stock">144</div>