# gettext issues



## xibo (Jul 20, 2013)

Hello,

I updated FreeBSD to 9-STABLE earlier this morning (from 9.2-PRERELEASE to 9.2-BETA1 r253470) and ran a ports update over an about 10 days old ports state, which resulted in devel/gettext being updated. However, since the update, _every_ call on msgfmt seems to fail:

```
...
Making all in po
gmake[2]: Entering directory `/usr/obj/usr/ports/net/avahi-app/work/avahi-0.6.31/po'
file=`echo bg | sed 's,.*/,,'`.gmo \
  && rm -f $file && /usr/local/bin/msgfmt -o $file bg.po
bg.po:22:9: invalid multibyte sequence
bg.po:22:10: invalid multibyte sequence
bg.po:22:11: invalid multibyte sequence
bg.po:22:12: invalid multibyte sequence
bg.po:22:13: invalid multibyte sequence
bg.po:22:14: invalid multibyte sequence
bg.po:22:15: invalid multibyte sequence
bg.po:22:16: invalid multibyte sequence
bg.po:22:17: invalid multibyte sequence
bg.po:22:18: invalid multibyte sequence
bg.po:26:9: invalid multibyte sequence
bg.po:26:10: invalid multibyte sequence
bg.po:26:11: invalid multibyte sequence
bg.po:26:12: invalid multibyte sequence
bg.po:26:13: invalid multibyte sequence
bg.po:26:14: invalid multibyte sequence
bg.po:26:15: invalid multibyte sequence
bg.po:26:16: invalid multibyte sequence
bg.po:26:17: invalid multibyte sequence
bg.po:26:18: invalid multibyte sequence
/usr/local/bin/msgfmt: too many errors, aborting
gmake[2]: *** [bg.gmo] Error 1
gmake[2]: Leaving directory `/usr/obj/usr/ports/net/avahi-app/work/avahi-0.6.31/po'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/usr/obj/usr/ports/net/avahi-app/work/avahi-0.6.31'
gmake: *** [all] Error 2
*** [do-build] Error code 1
...
```

bg.po seems not to contain any encoding or content-type errors. I can reproduce this with both Clang (WITH_CLANG_IS_CC) and GCC (`make CC=gcc CXX=g++`) built gettext. Is anyone else also experiencing this? Or know a fix?

Thanks in advance.


----------



## cpm@ (Jul 21, 2013)

Seems that msgfmt(1)() fails to encode when processing bg.po despite it's set the correct charset UTF-8 according to http://www.gnu.org/software/gettext/manual/html_node/Header-Entry.html, but I couldn't reproduce this error. 

Also, if you want to test if the PO files are syntactically valid, just run `% msgfmt -cv file.po`

This dirty trick should allow you to finish building:

```
# cd /usr/ports/net/avahi-app/ && make extract 
# cd work/avahi-0.6.31/po/ && rm bg.po && touch bg.po
# cd /usr/ports/net/avahi-app/ && make
```


----------



## kpa (Jul 22, 2013)

What's the locale(1) settings when you build the port? On my system it's all "C" locale because of use of ports-mgmt/poudriere-devel for building.


----------



## xibo (Jul 22, 2013)

My locale() was indeed set to _en_US.US-ASCII_ (due to VirtualBox being painful with Unicode). Changing it to _C_ or _en_US.UTF-8_ did not resolve the msgfmt issue, nor did removing all ports (and leftovers in /usr/local).

I'm currently backing up the user settings and will reset the OS to a clean 9.2-BETA1, maybe I broke some OS configuration ...


----------



## xibo (Jul 22, 2013)

I played around in order to find the source of this, and was able to tackle it down to WITH_ICONV.


----------



## cpm@ (Jul 23, 2013)

xibo said:
			
		

> I played around in order to find the source of this, and was able to tackle it down to WITH_ICONV.



That make sense, to enabled the libiconv dependency this should be added in net/avahi-app/Makefile:

```
--- Makefile.orig       2013-07-23 15:05:50.000000000 +0200
+++ Makefile    2013-07-23 15:06:23.000000000 +0200
@@ -26,7 +26,7 @@
 GROUPS?=       ${USERS}
 
 USE_GNOME+=    ltverhack glib20 intltool
-USES=          gettext gmake pathfix
+USES=          gettext gmake iconv pathfix
 USE_GNOME_SUBR=        yes
 USE_AUTOTOOLS= libtool
 USE_LDCONFIG=  yes
```


----------

