Strange encoding behavior