[sword-devel] swlocale question

Matthew Talbert ransom1982 at gmail.com
Thu Sep 3 17:12:39 MST 2009

On Thu, Sep 3, 2009 at 8:08 PM, Troy A. Griffitts<scribe at crosswire.org> wrote:
> Matthew,
> Are you sure you want the encoding of the locale?  They should all be in
>  UTF-8 if you are using a unicode enabled sword lib.

Well, actually I just want a valid locale :). I just noticed that this
code was there and was returning null, so I wondered why. (this is
very old code that isn't actually being used for anything anymore, I

> SWLocale::getEncoding merely returns the [Meta] Encoding= entry from the
> locale file.  If one does not have an entry, then it will be null.

yes, but it also returns null if you specify an invalid locale.

The problem was that we have a very bad algorithm for determining what
locale name to use, therefore the locale was always invalid. I'm not
sure of the best way to check that we have a valid locale, but we
should be doing that. Should SWORD return an error if we assign a
locale that doesn't exist?

Thanks for the help,


More information about the sword-devel mailing list