Fixed issue encoding invalid xml names.