diff options
| -rw-r--r-- | doc/lua-filters.md | 25 | ||||
| -rw-r--r-- | pandoc-lua-engine/pandoc-lua-engine.cabal | 2 | ||||
| -rw-r--r-- | stack.yaml | 1 |
3 files changed, 27 insertions, 1 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 diff --git a/pandoc-lua-engine/pandoc-lua-engine.cabal b/pandoc-lua-engine/pandoc-lua-engine.cabal index 4aae2a531..8aca57162 100644 --- a/pandoc-lua-engine/pandoc-lua-engine.cabal +++ b/pandoc-lua-engine/pandoc-lua-engine.cabal @@ -105,7 +105,7 @@ library , hslua-module-doclayout>= 1.0.4 && < 1.1 , hslua-module-path >= 1.0.3 && < 1.1 , hslua-module-system >= 1.0 && < 1.1 - , hslua-module-text >= 1.0 && < 1.1 + , hslua-module-text >= 1.0.3 && < 1.1 , hslua-module-version >= 1.0.3 && < 1.1 , hslua-module-zip >= 1.0.0 && < 1.1 , lpeg >= 1.0.1 && < 1.1 diff --git a/stack.yaml b/stack.yaml index d223efd7a..837fd098e 100644 --- a/stack.yaml +++ b/stack.yaml @@ -23,6 +23,7 @@ extra-deps: - hslua-core-2.2.1 - hslua-list-1.1.0 - hslua-marshalling-2.2.1 +- hslua-module-text-1.0.3 - hslua-module-version-1.0.3 - hslua-module-zip-1.0.0 - hslua-objectorientation-2.2.1 |
