chiark / gitweb /
disorder.h: more consistent approach to function attributes
[disorder] / lib / charset.c
index fdc6d619e25731755fcbeafa556b4819bbd0c88d..b8af6e68fdbf5b49edde7b018c1c085257937ad5 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * This file is part of DisOrder.
- * Copyright (C) 2004, 2005, 2007, 2008 Richard Kettlewell
+ * Copyright (C) 2004, 2005, 2007, 2008, 2013 Richard Kettlewell
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 
 #include "common.h"
 
-#include <iconv.h>
+#if HAVE_ICONV_H
+# include <iconv.h>
+#endif
 #include <errno.h>
-#include <langinfo.h>
+#if HAVE_LANGINFO_H
+# include <langinfo.h>
+#endif
 
 #include "mem.h"
 #include "log.h"
 #include "vector.h"
 #include "unicode.h"
 
+#if _WIN32
+// TODO WIN32 we assume UTF-8 here, which is *definitely wrong*
+char *mb2utf8(const char *mb) {
+  return xstrdup(mb);
+}
+
+char *utf82mb(const char *utf8) {
+  return xstrdup(utf8);
+}
+#else
+
 /** @brief Low-level converstion routine
  * @param from Source encoding
  * @param to Destination encoding
@@ -113,6 +128,8 @@ char *any2any(const char *from,
   else return xstrdup(any);
 }
 
+#endif
+
 /** @brief Truncate a string for display purposes
  * @param s Pointer to UTF-8 string
  * @param max Maximum number of columns