diff --git a/build.sh b/build.sh index 16010ea..c88e302 100755 --- a/build.sh +++ b/build.sh @@ -42,6 +42,7 @@ build() { -Dpangoxft="$pangoxft" \ -Dlibconfig="$libconfig" \ -Dopt="$opt" \ + -Dutf8="$utf8" \ build else meson setup \ @@ -54,6 +55,7 @@ build() { -Dpangoxft="$pangoxft" \ -Dlibconfig="$libconfig" \ -Dopt="$opt" \ + -Dutf8="$utf8" \ build fi diff --git a/buildconf b/buildconf index 531ee57..f50a5a3 100755 --- a/buildconf +++ b/buildconf @@ -12,6 +12,7 @@ openssl=true # enable support for openssl, used to calculate MD5 fribidi=true # enable support for right to left languages libconfig=true # enable configuration and themes xresources=true # enable .Xresources support +utf8=true # enable UTF-8 support opt=-O2 # level of optimization warn=true # warn about OS quirks install=true # automatically install, if set to false an install will not be performed diff --git a/libs/libdrw/drw.c b/libs/libdrw/drw.c index d1f5c9f..9f1d587 100644 --- a/libs/libdrw/drw.c +++ b/libs/libdrw/drw.c @@ -9,6 +9,11 @@ #define USEPANGO 0 #else #define USEPANGO 1 +#ifndef UTF8 +#define USEUTF8 0 +#else +#define USEUTF8 1 +#endif #endif #if USEPANGO @@ -318,7 +323,11 @@ char *parse_utf(char *str, size_t clen) { char *cstr = cnstr; size_t olen = clen; +#if USEUTF8 + iconv_t cd = iconv_open("UTF-8//IGNORE", "UTF-8"); +#else iconv_t cd = iconv_open("UTF-8//IGNORE", "ASCII"); +#endif if (cd == (iconv_t) - 1) { die("spmenu: iconv_open failed"); diff --git a/meson.build b/meson.build index 2c3935c..5718455 100644 --- a/meson.build +++ b/meson.build @@ -71,6 +71,10 @@ if get_option('xresources') build_args += [ '-DXRESOURCES' ] endif +if get_option('utf8') + build_args += [ '-DUTF8' ] +endif + project_target = executable( meson.project_name(), project_source_files, install : true, diff --git a/meson.options b/meson.options index 56282a3..c155e13 100644 --- a/meson.options +++ b/meson.options @@ -6,4 +6,5 @@ option('libconfig', type : 'boolean', value : true, description : 'Enable config option('pango', type : 'boolean', value : true, description : 'Enable Pango markup support') option('pangoxft', type : 'boolean', value : true, description : 'Enable Pango for libXft') option('xinerama', type : 'boolean', value : true, description : 'Enable multi-monitor support using libXinerama') +option('utf8', type : 'boolean', value : true, description : 'Enable UTF-8 character support') option('opt', type : 'string', value : '-O2', description : 'Optimization level')