[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gcal] Display length of non-ASCII
From: |
Göran Uddeborg |
Subject: |
Re: [Bug-gcal] Display length of non-ASCII |
Date: |
Sun, 19 Jun 2016 22:56:52 +0200 |
I took a little look at this myself, and thought maybe it could be
done using libunistring and gnulib by default, without any flag. I
attach a first step in that direction for your consideration. Do you
think this is a reasonable way forward? Or do you have different
ideas how this should be done?
I submit it as a patch only to show what I mean. This is in no way a
complete thing. Single-byte locales do not behave properly for
example, and I haven't learned how to pick up the functions from
gnulib when compiling on a system where libunistring isn't available.
I'm not suggesting to apply the patch in this form. I'm only asking
for some feedback if it make sense for me to continue working with it.
>From 68dd3d3f410702c3c3317e9735780fe0f89ca7da Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=B6ran=20Uddeborg?= <address@hidden>
Date: Sun, 19 Jun 2016 22:44:22 +0200
Subject: [PATCH] Use libunistring by default to handle multibyte messages.
---
bootstrap.conf | 1 +
configure.ac | 16 ++++++----------
src/common.h | 2 +-
3 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/bootstrap.conf b/bootstrap.conf
index bad10ae..8682eb3 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -50,6 +50,7 @@ iconv
iconv-h
ioctl
langinfo
+libunistring
link
list
locale
diff --git a/configure.ac b/configure.ac
index f339765..fe197e9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,16 +85,6 @@ dnl
AC_MSG_RESULT()
AC_CHECKING(for $PACKAGE specific package options)
dnl
-AC_MSG_CHECKING(whether unicode support is required)
-AC_ARG_ENABLE(unicode,
- [ --enable-unicode use unicode],
- gcal_cv_use_unicode=$enableval,
- gcal_cv_use_unicode=no)
-AC_MSG_RESULT($gcal_cv_use_unicode)
-if test "$gcal_cv_use_unicode" = yes; then
- AC_DEFINE([USE_UNICODE], [1], [Enable unicode.])
-fi
-dnl
AC_MSG_CHECKING(whether extended ASCII character set is required)
AC_ARG_ENABLE(easc,
[ --enable-easc use extended ASCII character set],
@@ -400,6 +390,12 @@ AC_CHECK_LIB(m,
AC_SUBST(LIBM)
dnl
+dnl Check for Unicode string library
+dnl
+gl_LIBUNISTRING
+LIBS="$LIBS $LIBUNISTRING"
+
+dnl
dnl Checks for header files.
dnl
AC_MSG_RESULT()
diff --git a/src/common.h b/src/common.h
index 97c5f64..a1aa42f 100644
--- a/src/common.h
+++ b/src/common.h
@@ -35,7 +35,7 @@
/*
* Include (sub)header files ;<
*/
-# if USE_UNICODE
+# if HAVE_LIBUNISTRING
# include "unistdio.h"
# include "unistr.h"
# undef sprintf
--
2.7.4