Comments (3)
因为不能通过&获取一个切片的实际数据的地址:
也就是:
// p1 指向 data1 的第一个元素的地址
var data1 [512]byte
p1 := &data1
// p2指向data2切片结构体的地址
data2 := make([]byte,512)
p2 := &data2
无法把这个p2作为参数调用c里的函数。
另外,无法在转换前知晓转换后的字符串有多长。
=-=
go要定义一个编译时不知长度的数组可以这么搞:
//#include <stdlib.h>
import "C"
arr := C.malloc(n)
跑路……
from iconv.
我也遇到这个问题了。
from iconv.
我的解决方案:
import "io/ioutil"
import "golang.org/x/net/html/charset"
func convrtToUTF(str string, origEncoding string) string {
strBytes := []byte(str)
byteReader := bytes.NewReader(strBytes)
reader, _ := charset.NewReaderLabel(origEncoding, byteReader)
strBytes, _ = ioutil.ReadAll(reader)
return string(strBytes)
}
from iconv.
Related Issues (20)
- 安装失败:clang: error: linker command failed with exit code 1 (use -v to see invocation)
- 编译时报 gcc: 错误:unrecognized command line option ‘-mthreads’ 错误 HOT 2
- 建议在 iconv.go 前面加上支持不同平台链接的标记 HOT 1
- 安装不成功 HOT 3
- undefined refrence to 'libconv'
- Problem with MingW
- Crash in Iconv.DoWrite HOT 1
- Can't work with golang 1.6.x HOT 2
- Using //TRANSLIT HOT 1
- iconv 对‘libiconv’未定义的引用 HOT 2
- Hello,you can contain the libiconv.a in package, like the following:
- Getting `signal: killed` using your convstr.go example HOT 1
- ../gopkg.in/iconv.v1/reader.go:10:5: undefined: Iconv HOT 3
- Windows 10 x64 交叉编译到 Linux amd64 显示错误 HOT 1
- Support go mod HOT 1
- ConvString support big string HOT 1
- ??? HOT 1
- macos 12.0 has warning
- GOOS=windows GOARCH=amd64 go build main.go
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iconv.