예제 #1
0
func (doc *HtmlDocument) SetMetaEncoding(encoding string) (err error) {
	var encodingPtr unsafe.Pointer = nil
	if len(encoding) > 0 {
		encodingBytes := AppendCStringTerminator([]byte(encoding))
		encodingPtr = unsafe.Pointer(&encodingBytes[0])
	}
	ret := int(C.htmlSetMetaEncoding((*C.xmlDoc)(doc.DocPtr()), (*C.xmlChar)(encodingPtr)))
	if ret == -1 {
		err = ErrSetMetaEncoding
	}
	return
}
예제 #2
0
// htmlSetMetaEncoding
func (doc *HTMLDocument) SetMetaEncoding(encoding string) int {
	ptr := C.CString(encoding)
	defer C.free_string(ptr)
	return int(C.htmlSetMetaEncoding(doc.Ptr, C.to_xmlcharptr(ptr)))
}