我目前正在解析包含大量地理數據的XML文件。XMLParsing字符串編碼
基本上,該文件包含一個城市列表,其中可能包含此外語替代名稱的示例列表。顯示的示例顯示了柏林的替代名稱的列表:
<alternateName lang="af">Berlyn</alternateName>
<alternateName lang="als">Berlin</alternateName>
<alternateName lang="an">Berlín</alternateName>
<alternateName lang="ang">Berlin</alternateName>
<alternateName lang="ar">برلين</alternateName>
<alternateName lang="arc">ܒܪܠܝܢ</alternateName>
<alternateName lang="ast">Berlín</alternateName>
<alternateName lang="bar">Berlin</alternateName>
<alternateName lang="be">Бэрлін</alternateName>
<alternateName lang="bg">Берлин</alternateName>
<alternateName lang="bn">বার্লিন</alternateName>
<alternateName lang="br">Berlin</alternateName>
<alternateName lang="bs">Berlin</alternateName>
<alternateName lang="ca">Estat de Berlín</alternateName>
<alternateName lang="cs">Berlín</alternateName>
<alternateName lang="csb">Berlëno</alternateName>
<alternateName lang="cv">Берлин</alternateName>
<alternateName lang="cy">Berlin</alternateName>
<alternateName lang="da">Berlin</alternateName>
<alternateName lang="de">Berlin</alternateName>
<alternateName lang="el">Βερολίνο</alternateName>
<alternateName lang="en">Berlin</alternateName>
<alternateName lang="eo">Berlino</alternateName>
<alternateName lang="es">Berlín</alternateName>
<alternateName lang="et">Berliin</alternateName>
<alternateName lang="eu">Berlin</alternateName>
<alternateName lang="fa">برلین</alternateName>
<alternateName lang="fi">Berliini</alternateName>
<alternateName lang="fo">Berlin</alternateName>
<alternateName lang="fr">Berlin</alternateName>
<alternateName lang="ga">Beirlín</alternateName>
<alternateName lang="gd">Berlin</alternateName>
<alternateName lang="gl">Berlín</alternateName>
<alternateName lang="hbs">Berlin</alternateName>
<alternateName lang="he">ברלין</alternateName>
<alternateName lang="hr">Berlin</alternateName>
<alternateName lang="hu">Berlin</alternateName>
<alternateName lang="hy">Բերլին</alternateName>
<alternateName lang="ia">Berlin</alternateName>
<alternateName lang="iata">BER</alternateName>
<alternateName lang="id">Berlin</alternateName>
<alternateName lang="io">Berlin</alternateName>
<alternateName lang="is">Berlín</alternateName>
<alternateName lang="it">Berlino</alternateName>
<alternateName lang="ja">ベルリン</alternateName>
<alternateName lang="jv">Berlin</alternateName>
<alternateName lang="ka">ბერლინი</alternateName>
<alternateName lang="ko">베를린</alternateName>
<alternateName lang="ku">Berlîn</alternateName>
<alternateName lang="kw">Berlin</alternateName>
<alternateName lang="la">Berolinum</alternateName>
<alternateName lang="lb">Berlin</alternateName>
<alternateName lang="li">Berlien</alternateName>
<alternateName lang="link">http://en.wikipedia.org/wiki/Berlin</alternateName>
<alternateName lang="lt">Berlynas</alternateName>
<alternateName lang="lv">Berlīne</alternateName>
<alternateName lang="mk">Берлин</alternateName>
<alternateName lang="mr">बर्लिन</alternateName>
<alternateName lang="ms">Berlin</alternateName>
<alternateName lang="nds">Berlin</alternateName>
<alternateName lang="nl">Berlijn</alternateName>
<alternateName lang="nn">Berlin</alternateName>
<alternateName lang="no">Berlin</alternateName>
<alternateName lang="nrm">Bèrlîn</alternateName>
<alternateName lang="oc">Berlin</alternateName>
<alternateName lang="pdc">Berlin</alternateName>
<alternateName lang="pl">Berlin</alternateName>
<alternateName lang="pms">Berlin</alternateName>
<alternateName lang="pt">Berlim</alternateName>
<alternateName lang="qu">Berlin</alternateName>
<alternateName lang="rm">Berlin</alternateName>
<alternateName lang="ro">Berlin</alternateName>
<alternateName lang="ru">Берлин</alternateName>
<alternateName lang="scn">Birlinu</alternateName>
<alternateName lang="sk">Berlín</alternateName>
<alternateName lang="sl">Berlin</alternateName>
<alternateName lang="sq">Berlini</alternateName>
<alternateName lang="sr">Берлин</alternateName>
<alternateName lang="sv">Berlin</alternateName>
<alternateName lang="sw">Berlin</alternateName>
<alternateName lang="ta">பெர்லின்</alternateName>
<alternateName lang="th">เบอร์ลิน</alternateName>
<alternateName lang="tr">Berlin</alternateName>
<alternateName lang="ty">Berlin</alternateName>
<alternateName lang="ug">بېرلىن</alternateName>
<alternateName lang="uk">Берлін</alternateName>
<alternateName lang="vi">Berlin</alternateName>
<alternateName lang="vo">Berlin</alternateName>
<alternateName lang="yi">בערלין</alternateName>
<alternateName lang="zh">柏林</alternateName>
的XML-頭看起來是這樣的: <?xml version="1.0" encoding="UTF-8" standalone="no"?>
自身工作完全正常,但很多名字都沒有顯示解析正確由於格式問題。我試過UTF-8編碼沒有成功。
我現在的問題是對數據進行編碼的正確方法是什麼,以便正確顯示它?
在此先感謝!
如果你的設備支持各自的字體,那麼你沒有問題,如果任何特定的字體不支持你的設備,那麼你將無法顯示。 – Ashim