Bug 1077859: Make ENCODING_FAILED safe to use in static initializers, r=mmc

--HG--
extra : rebase_source : f0483e775c6fefc256fc9527b1b1118086cc121f
Bug 1077887: Work around old GCC "enum class" bug, r=mmc

--HG--
extra : rebase_source : 983e8d8bcfded10d1d1dca793d610996b40b444d