Converts between different character encodings. On UNIX, this uses the iconv library, on Windows the Windows API.
EncodingConverter = object dest, src: CodePage
EncodingError = object of ValueError
proc getCurrentEncoding(): string {.raises: [], tags: [].}
proc open(destEncoding = "UTF-8"; srcEncoding = "CP1252"): EncodingConverter {. raises: [OverflowError, EncodingError], tags: [].}
proc close(c: EncodingConverter) {.raises: [], tags: [].}
proc convert(c: EncodingConverter; s: string): string {.raises: [OSError], tags: [].}
proc convert(s: string; destEncoding = "UTF-8"; srcEncoding = "CP1252"): string {. raises: [OverflowError, EncodingError, OSError], tags: [].}
© 2006–2017 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/encodings.html