斯堪的纳维亚字符在go-lang go-instagram API绑定中不起作用
Hi I'm trying to wrap my head around what seems to be a problem with multibyte support in this open source library (https://github.com/carbocation/go-instagram/). I am using the code below to retrieve information about the tag blue in swedish. How ever I get an empty array when trying.
fmt.Println("Starting instagram download.")
client := instagram.NewClient(nil)
client.ClientID = "myid"
media, _, _ := client.Tags.RecentMedia("blå", nil)
fmt.Println(media)
I have tried using the api trough the browser and there are several pictures tagged with the tag. I have also tried using the code snippet with tags in English like blue and that returns the latest pictures as well. I would be glad if any one could explain why this might happen. Id like to update the lib so it supports multi-byte but I haven't got the go knowledge required. Is this a go problem or a problem with the library?
Thank you
嗨,我正在努力解决这个开源库中支持多字节的问题 ( https://github.com/carbocation/go-instagram/ )。 我正在使用下面的代码来检索有关瑞典蓝色标签的信息。 p>
fmt.Println(“正在启动instagram下载。”)
client:= instagram.NewClient(nil)
client.ClientID = “ myid”
media,_,_:= client.Tags.RecentMedia(“blå”,nil)
fmt.Println(media)
code> pre>
我尝试过 使用浏览器中的api,有几张用标签标记的图片。 我还尝试过将代码片段与英语标签(例如蓝色)一起使用,它也会返回最新图片。 如果有人能解释为什么会发生,我将很高兴。 我想更新该库,以便它支持多字节,但是我还没有所需的知识。 这是执行问题还是库问题? p>
谢谢 p>
div>
The problem is in validTagName()
:
// Strip out things we know Instagram won't accept. For example, hyphens.
func validTagName(tagName string) (bool, error) {
//\W matches any non-word character
reg, err := regexp.Compile(`\W`)
if err != nil {
return false, err
}
if reg.MatchString(tagName) {
return false, nil
}
return true, nil
}
In Go, \W
matches precisely [^0-9A-Za-z_]
. This validation check is incorrect.