Fix iconv import on freebsd and netbsd (#5490)
This commit is contained in:
parent
3fa428c88b
commit
24ec36f097
1 changed files with 9 additions and 4 deletions
|
|
@ -277,16 +277,21 @@ else:
|
||||||
|
|
||||||
var errno {.importc, header: "<errno.h>".}: cint
|
var errno {.importc, header: "<errno.h>".}: cint
|
||||||
|
|
||||||
|
when defined(freebsd) or defined(netbsd):
|
||||||
|
{.pragma: importIconv, cdecl, header: "<iconv.h>".}
|
||||||
|
else:
|
||||||
|
{.pragma: importIconv, cdecl, dynlib: iconvDll.}
|
||||||
|
|
||||||
proc iconvOpen(tocode, fromcode: cstring): EncodingConverter {.
|
proc iconvOpen(tocode, fromcode: cstring): EncodingConverter {.
|
||||||
importc: "iconv_open", cdecl, dynlib: iconvDll.}
|
importc: "iconv_open", importIconv.}
|
||||||
proc iconvClose(c: EncodingConverter) {.
|
proc iconvClose(c: EncodingConverter) {.
|
||||||
importc: "iconv_close", cdecl, dynlib: iconvDll.}
|
importc: "iconv_close", importIconv.}
|
||||||
proc iconv(c: EncodingConverter, inbuf: var cstring, inbytesLeft: var int,
|
proc iconv(c: EncodingConverter, inbuf: var cstring, inbytesLeft: var int,
|
||||||
outbuf: var cstring, outbytesLeft: var int): int {.
|
outbuf: var cstring, outbytesLeft: var int): int {.
|
||||||
importc: "iconv", cdecl, dynlib: iconvDll.}
|
importc: "iconv", importIconv.}
|
||||||
proc iconv(c: EncodingConverter, inbuf: pointer, inbytesLeft: pointer,
|
proc iconv(c: EncodingConverter, inbuf: pointer, inbytesLeft: pointer,
|
||||||
outbuf: var cstring, outbytesLeft: var int): int {.
|
outbuf: var cstring, outbytesLeft: var int): int {.
|
||||||
importc: "iconv", cdecl, dynlib: iconvDll.}
|
importc: "iconv", importIconv.}
|
||||||
|
|
||||||
proc getCurrentEncoding*(): string =
|
proc getCurrentEncoding*(): string =
|
||||||
## retrieves the current encoding. On Unix, always "UTF-8" is returned.
|
## retrieves the current encoding. On Unix, always "UTF-8" is returned.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue