提交到 Web 服务器的希伯来语字符串未收到希伯来语版本

发布于 2024-12-04 07:24:38 字数 822 浏览 0 评论 0原文

我从我的应用程序向 Web 服务器提交注册表单:

EditText email = (EditText)findViewById(R.id.email);
EditText password = (EditText)findViewById(R.id.password);
EditText nickname = (EditText)findViewById(R.id.nickname);

List<NameValuePair> params = new ArrayList<NameValuePair>(2);
params.add(new BasicNameValuePair("email", email.getText().toString()));
params.add(new BasicNameValuePair("password", password.getText().toString()));
params.add(new BasicNameValuePair("nickname", nickname.getText().toString()));

HttpClient httpClient = new DefaultHttpClient();
HttpPost request = new HttpPost(url);
request.setEntity(new UrlEncodedFormEntity(params));
HttpResponse response = httpClient.execute(request);

当我用希伯来语输入昵称时,服务器(php/apache)会以与昵称长度相同的字符串形式接收该昵称,但字符为“不可见”,即看起来像空白。绝对不是希伯来语。有人有任何线索吗?

I submit a sign up form from my app to the web server:

EditText email = (EditText)findViewById(R.id.email);
EditText password = (EditText)findViewById(R.id.password);
EditText nickname = (EditText)findViewById(R.id.nickname);

List<NameValuePair> params = new ArrayList<NameValuePair>(2);
params.add(new BasicNameValuePair("email", email.getText().toString()));
params.add(new BasicNameValuePair("password", password.getText().toString()));
params.add(new BasicNameValuePair("nickname", nickname.getText().toString()));

HttpClient httpClient = new DefaultHttpClient();
HttpPost request = new HttpPost(url);
request.setEntity(new UrlEncodedFormEntity(params));
HttpResponse response = httpClient.execute(request);

When I type the nickname in Hebrew, it is received in the server (php/apache) as a string in the same length as the nickname, but with characters which are "invisible", i.e. look like blank spaces. definitely not Hebrew. Any clue someone?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半窗疏影 2024-12-11 07:24:38

我认为只需执行 request.setEntity(new UrlEncodedFormEntity(params)); 即可在 DEFAULT_CONTENT_CHARSET 中对参数进行编码(请参阅 http://developer.android.com/reference/org/apache/http/client/entity/UrlEncodedFormEntity.html)。

您可能应该使用 UrlEncodedFormEntity(Listparameters, String encoding) 表单。 Froyo/Android 2.2 添加了对以希伯来语和阿拉伯语(以及其他语言)显示文本的支持,包括所需的字体,但我仍在寻找希伯来语编码字符串...

您是否尝试过编码为“UTF-8”或“UTF-” 16英寸?

I think that just doing request.setEntity(new UrlEncodedFormEntity(params)); encodes your parameters in the DEFAULT_CONTENT_CHARSET (see http://developer.android.com/reference/org/apache/http/client/entity/UrlEncodedFormEntity.html).

You should probably use the UrlEncodedFormEntity(List<? extends NameValuePair> parameters, String encoding) form. Froyo/Android 2.2 added support for displaying text in Hebrew and Arabic (among other languages), including the needed fonts, but I am still looking for Hebrew encoding string...

Have you tried encoding as "UTF-8" or "UTF-16"?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文