Literal

The literal encoding handles C and C++ string literals ("🐱") used at compile time and stored in the binary. The library uses a number of heuristics to determine with any degree of certainty what the encoding of string literals are, but in some cases it is not explicitly possible to achieve this goal.

If the library cannot figure out the literal encoding, the code will typically error with a static_assert, loudly, that it cannot use the functions on the type when you attempt to do anything with them because it may mangle whatever input or output you are expecting.

If you know the encoding of literals for your project (you provide the command line switch, or similar), then you can define a configuration macro named ZTD_CXX_COMPILE_TIME_ENCODING_NAME to be a string literal of your type, such as "UTF-8" or "ISO-8859-1".

If the library does not recognize the encoding and cannot transcode it properly, it will also loudly warn you that it does not understand the encoding of the literal (in which case, file an issue about it and we will add it to the list of acceptable literal encodings).

If you like to live dangerously and do not care for the warnings, you can define a configuration macro named ZTD_TEXT_YES_PLEASE_DESTROY_MY_LITERALS_UTTERLY_I_MEAN_IT and it will just blindly go with whatever weird default it ended up deciding on.

(This is usually a catastrophically terrible idea, but let is not be said that we didn’t give you the power to do great things, even if it cost you your foot.)

Warning

doxygenvariable: Cannot find file: /home/docs/checkouts/readthedocs.org/user_builds/ztdtext/checkouts/latest/documentation/source/_build/cmake-build/documentation/doxygen/xml/index.xml

Warning

doxygenclass: Cannot find file: /home/docs/checkouts/readthedocs.org/user_builds/ztdtext/checkouts/latest/documentation/source/_build/cmake-build/documentation/doxygen/xml/index.xml