djimenez / iconv-go

iconv support for Go
BSD 2-Clause "Simplified" License
418 stars 66 forks source link

invalid argument #12

Closed golangfan closed 10 years ago

golangfan commented 10 years ago

content, err := iconv.ConvertString(string(body), "GB-18030", "UTF-8")

When i set GB-18030 i got a "invalid argument" error ?

I change the value "GB18030" is ok

djimenez commented 10 years ago

Does your iconv command accept "GB-18030" on the command line? Mine certainly does not:

$ echo "" | iconv -f GB-18030 -t utf-8
iconv: conversion from `GB-18030' is not supported
Try `iconv --help' or `iconv --usage' for more information.

Since I'm not doing any massaging of the string inputs before giving them to iconv functions, it's expected it would give the error. iconv does not consider that a valid alias.

golangfan commented 10 years ago

Thank you ~

I get the "GB-18030" from github.com/saintfish/chardet this package .

lnnt commented 1 year ago

GB2312//IGNORE -> GB2312