我在我的项目https://godoc.org/code.google.com/p/go.text/encoding中使用go.text
我不明白为什么它会丢失iso-8859-1?
我知道我可以轻松转码它byte -> rune -> utf8
在Go中解组ISO-8859-1 XML输入
但我想知道go.text中是否有一些编码,iso-8859-1但命名方式不同.我知道它有以下名字.
ISO_8859-1:1987
ISO-8859-1
iso-ir-100
ISO_8859-1
latin1
l1
IBM819
CP819
csISOLatin1
Run Code Online (Sandbox Code Playgroud) 我正在尝试在Go中为一个大型xml文件(dblp.xml)编写一个非常简单的解析器,其摘录如下:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE dblp SYSTEM "dblp.dtd">
<dblp>
<article key="journals/cacm/Gentry10" mdate="2010-04-26">
<author>Craig Gentry</author>
<title>Computing arbitrary functions of encrypted data.</title>
<pages>97-105</pages>
<year>2010</year>
<volume>53</volume>
<journal>Commun. ACM</journal>
<number>3</number>
<ee>http://doi.acm.org/10.1145/1666420.1666444</ee>
<url>db/journals/cacm/cacm53.html#Gentry10</url>
</article>
<article key="journals/cacm/Gentry10" mdate="2010-04-26">
<author>Craig Gentry Number2</author>
<title>Computing arbitrary functions of encrypted data.</title>
<pages>97-105</pages>
<year>2010</year>
<volume>53</volume>
<journal>Commun. ACM</journal>
<number>3</number>
<ee>http://doi.acm.org/10.1145/1666420.1666444</ee>
<url>db/journals/cacm/cacm53.html#Gentry10</url>
</article>
</dblp>
Run Code Online (Sandbox Code Playgroud)
我的代码如下所示,看起来有些东西正在进行xml.Unmarshal(byteValue, &articles),因为我无法在输出中获得任何xml的值.你能帮我解决我的代码有什么问题吗?
package main
import (
"encoding/xml"
"fmt"
"io/ioutil"
"os"
)
// Contains the array of articles in the dblp xml
type Dblp struct { …Run Code Online (Sandbox Code Playgroud)