提交给Web服务器希伯来语字符串希伯来语都没有收到 [英] Hebrew strings submitted to web server aren't received in Hebrew

查看:139
本文介绍了提交给Web服务器希伯来语字符串希伯来语都没有收到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我提交注册表格,从我的应用程序到Web服务器:

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);

当我输入希伯来文的绰号,它是在服务器(PHP /阿帕奇)作为相同长度的昵称字符串接受,但它们是无形字,即像空格。绝对不是希伯来语。任何线索的人?

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?

推荐答案

我觉得只是做 request.setEntity(新UrlEn codedFormEntity(PARAMS)); EN codeS您在DEFAULT_CONTENT_CHARSET参数(请参阅http://developer.android.com/reference/org/apache/http/client/entity/UrlEn$c$cdFormEntity.html).

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).

您或许应该使用 UrlEn codedFormEntity(列表&LT ;?延伸的NameValuePair&GT;参数字符串编码)的形式。升级Froyo / Android 2.2的支持,增加对希伯来语和阿拉伯语显示文本(在其他语言中),包括所需的字体,但我仍然在寻找希伯来语编码字符串...

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...

您是否尝试过编码为UTF-8或UTF-16?

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

这篇关于提交给Web服务器希伯来语字符串希伯来语都没有收到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆