From acfe55ab906ba2fbe14f3c19f085cabe2cbe25c5 Mon Sep 17 00:00:00 2001 From: Grzegorz Adam Hankiewicz Date: Fri, 14 Dec 2012 23:32:11 +0100 Subject: Adds macosx dynamic library name for libiconv. Also adds some verbosity to the implicit test. --- lib/pure/encodings.nim | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/pure/encodings.nim b/lib/pure/encodings.nim index 6421b6f44..ce4238409 100755 --- a/lib/pure/encodings.nim +++ b/lib/pure/encodings.nim @@ -254,6 +254,8 @@ when defined(windows): else: when defined(haiku): const iconvDll = "(libc.so.6|libiconv.so|libtextencoding.so)" + elif defined(macosx): + const iconvDll = "libiconv.dylib" else: const iconvDll = "(libc.so.6|libiconv.so)" @@ -449,8 +451,13 @@ proc convert*(s: string, destEncoding = "UTF-8", close(c) when IsMainModule: - var orig = "öäüß" - var crap = convert(orig, "CP1252", "UTF-8") - echo convert(crap, "ibm850", "CP1252") - echo getCurrentEncoding() + let + orig = "öäüß" + cp1252 = convert(orig, "CP1252", "UTF-8") + ibm850 = convert(cp1252, "ibm850", "CP1252") + current = getCurrentEncoding() + echo "Original string from source code: ", orig + echo "Forced ibm850 encoding: ", ibm850 + echo "Current encoding: ", current + echo "From ibm850 to current: ", convert(ibm850, current, "ibm850") -- cgit 1.4.1-2-gfad0