diff options
| author | Albert Krewinkel <albert@zeitkraut.de> | 2023-01-02 22:41:40 +0100 |
|---|---|---|
| committer | Albert Krewinkel <albert+github@zeitkraut.de> | 2023-01-03 10:35:22 +0100 |
| commit | 8862d5e0dda27d19e28eb465f79c14bd5cbfe77e (patch) | |
| tree | d590ac12b3823363b29fdcb64c572b1e82e7592b /doc/lua-filters.md | |
| parent | 355794549d29e011823c27062d902c8a69f2de86 (diff) | |
Lua: add functions `pandoc.text.toencoding`, `pandoc.text.fromencoding`.
Closes: #8512
Diffstat (limited to 'doc/lua-filters.md')
| -rw-r--r-- | doc/lua-filters.md | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/doc/lua-filters.md b/doc/lua-filters.md index 2a9787f4f..ca9fbd43e 100644 --- a/doc/lua-filters.md +++ b/doc/lua-filters.md @@ -2418,6 +2418,18 @@ function Str (s) end ``` +### fromencoding {#text.fromencoding} + +`fromencoding(s, encoding)` + +Converts a string to UTF-8. The `encoding` parameter specifies the +encoding of the input string. On Windows, that parameter defaults +to the current ANSI code page; on other platforms the function +will try to use the file system's encoding. + +See [`toencoding`](#text.toencoding) for more info on supported +encodings. + ### lower {#text.lower} `lower (s)` @@ -2449,6 +2461,19 @@ Returns the length of a UTF-8 string. Returns a substring of a UTF-8 string, using Lua's string indexing rules. +### toencoding {#text.toencoding} + +`toencoding(s, encoding)` + +Converts a UTF-8 string to a different encoding. The `encoding` +parameter defaults to the current ANSI code page on Windows; on +other platforms it will try to guess the file system's encoding. + +The set of known encodings is system dependent, but includes at +least `UTF-8`, `UTF-16BE`, `UTF-16LE`, `UTF-32BE`, and `UTF-32LE`. +Note that the default code page on Windows is available through +`CP0`. + # Module pandoc Fields and functions for pandoc scripts; includes constructors for |
