Encoding of custom option post indexes, upstream from zenphoto

Also a few small fixes discovered when testing the demo theme and plugin and some fale-safe handling for locale setting