最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

xml - Turkish character problem in Node.js fs.readFile - Stack Overflow

programmeradmin0浏览0评论

I have a XML file which is created in Windows. It has some Turkish characters in it.

<?xml version="1.0" encoding="iso-8859-9"?><?xml-stylesheet type="text/xsl" ?>
<DespatchAdvice xmlns="urn:oasis:names:specification:ubl:schema:xsd:DespatchAdvice-2" xmlns:xsi="; xmlns:xs="; xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
    <cbc:UBLVersionID>2.1</cbc:UBLVersionID>
    <cbc:CustomizationID>TR1.2.1</cbc:CustomizationID>
    <cbc:ProfileID>TEMELIRSALIYE</cbc:ProfileID>
    <cbc:UUID>4B0F020F-6F17-4F12-BE45-25ECCEA05A25</cbc:UUID>
    <cac:DespatchSupplierParty>
        <cac:Party>
            <cac:PostalAddress>
                <cbc:StreetName>DEMİRTAŞ OSB FESLEĞEN SK.</cbc:StreetName>
            </cac:PostalAddress>
            <cac:PartyTaxScheme>
                <cac:TaxScheme>
                    <cbc:Name>ULUDAĞ VERGİ DAİRESİ</cbc:Name>
                </cac:TaxScheme>
            </cac:PartyTaxScheme>
        </cac:Party>
    </cac:DespatchSupplierParty>
</DespatchAdvice>

I'm reading file with this code:

fs.readFile(uploadedDoc[0].path, "utf8", function (err, data) {
 ...
}

But Turkish characters not converting correctly. I also tried "latin1" or "cp1254" but no success. What should I do?

发布评论

评论列表(0)

  1. 暂无评论