summaryrefslogtreecommitdiff
path: root/wsutil/unicode-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'wsutil/unicode-utils.c')
-rw-r--r--wsutil/unicode-utils.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/wsutil/unicode-utils.c b/wsutil/unicode-utils.c
index 8935e46f38..21cc489df7 100644
--- a/wsutil/unicode-utils.c
+++ b/wsutil/unicode-utils.c
@@ -22,12 +22,23 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef _WIN32
-#error "This is only for Windows"
-#endif
-
#include "unicode-utils.h"
+int
+ws_utf8_char_len(guint8 ch)
+{
+ if (ch >= 0xfe) return -1;
+ if (ch >= 0xfc) return 6;
+ if (ch >= 0xf8) return 5;
+ if (ch >= 0xf0) return 4;
+ if (ch >= 0xe0) return 3;
+ if (ch >= 0xc0) return 2;
+ else return 1;
+}
+
+
+#ifdef _WIN32
+
#include <shellapi.h>
/** @file
@@ -157,3 +168,5 @@ arg_list_utf_16to8(int argc, char *argv[]) {
}
} /* XXX else bail because something is horribly, horribly wrong? */
}
+
+#endif