Added String encoding check for decoding XML streams