Hello,
I have issue with parsing XML using XMLParser when XML contains German specific characters, for example ü
This code:
has following output in Playground:
It looks to me like that XMLParser is not able to parse XML with German characters correctly, because with following XML:
output is correct:
Do you have any idea how to solve this issue?
Thank you
I have issue with parsing XML using XMLParser when XML contains German specific characters, for example ü
This code:
Code Block swift import Foundation let xml = "<Xml><Tag>Martin Hübner</Tag><Tag>Value</Tag></Xml>" let data = xml.data(using: .utf8)! let parser = XMLParser(data: data) let parserDelegate = ParserDelegate() parser.delegate = parserDelegate parser.parse() class ParserDelegate: NSObject, XMLParserDelegate { func parser(_ parser: XMLParser, foundCharacters string: String) { print("foundCharacters: \(string)") } }
has following output in Playground:
Code Block foundCharacters: Martin H foundCharacters: übner foundCharacters: Value
It looks to me like that XMLParser is not able to parse XML with German characters correctly, because with following XML:
Code Block swift let xml = "<Xml><Tag>Hello World</Tag><Tag>Value</Tag></Xml>"
output is correct:
Code Block foundCharacters: Hello World foundCharacters: Value
Do you have any idea how to solve this issue?
Thank you