Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map selection problem under the GoogleTranslator class setFormData() under jdk 1.8 #5

Open
water-law opened this issue Aug 9, 2018 · 1 comment

Comments

@water-law
Copy link

water-law commented Aug 9, 2018

#title for chinese: jdk 1.8 下 GoogleTranslator 类 setFormData() 的 Map 选择问题

The formData in the setFormData() method is a HashMap, the HashMap does not support key duplication, and the google translation form submission requires a dt field, which has multiple values.

Solution: You can change the HashMap to IdentityHashMap in the AbstractHttpAttribute parent class, and then have the same key, formData.put(new String("key"), "value");

ps:
In order to support internationalization, first use English to play it again. Recently, the google translation API is not used.

setFormData() 方法中 formData 是一个 HashMap, HashMap 不支持 key 重复, 而 google 翻译表单提交时 需要 dt 字段, 该字段有多个值。

解决方案: 可以在 AbstractHttpAttribute 父类中将 HashMap 改为 IdentityHashMap, 然后有相同 key 时, formData.put(new String("key"), "value");

ps:
为了支持国际化, 先用英文打一遍, 用这个频繁调用翻译接口还是会超时,腾讯、google 他们应该有反爬虫机制。

@hujingshuang
Copy link
Owner

hujingshuang commented Aug 10, 2018

@water-law 兄台,可以提个 PR,我 review 合一下。
Hi, Boy. You can open a pull request, I will merge it after code review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants