を返しません。私は、検索文字列を埋めるためにEDITTEXTを持っている:のAndroidのEditTextが正しいUTF-8テキスト
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/search_input_edittext"
android:gravity="center_horizontal"
android:layout_gravity="center_horizontal" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:padding="10dp"
android:background="@drawable/add_to_cart_btn"
android:text="@string/search"
android:id="@+id/search_search_btn"
android:stateListAnimator="@null"
android:layout_gravity="center_horizontal" />
</LinearLayout>
しかし、私はと入力ベトナム語が正しくgetText().getString()
ではありません。これは、ことになっている
CU
(私は手動でこれを入力した)が、私はコードから得たもの:
:
EditText search_edittext = (EditText) v_iew.findViewById(R.id.search_input_edittext); //v_iew is from inflating for `AlertDialog`
search_edittext.getText().toString();
私はそれらが異なってコードされていると思います。フックは "u"の上になければなりません。しかし、単語全体をコピーしてエディタに貼り付けると、まったく同じように表示されます。これは、私がここでそれを貼り付けるときのようになります。
CU
、これは私がフックをコピーする場合に発生するものであるだけ
̉
彼ら同じように見えますが、EditText
のものは今後の作業には使用できません。
インターネットから単語をコピーして検索フィールドに貼り付けると機能します。だから問題を引き起こしたのは私の入力方法です。それらをユニコード(\ xxxxのもの)に変換することを検索しようとしましたが運がありません。
誰でも入力を「標準形式」に変換する方法はありますか?あなたの時間をありがとう!
これは私のGETメソッドのコードです。 UTF-8はどこに配置するべきですか? 'HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost =新しいHttpPost(params [0]); HttpResponseレスポンス= httpclient.execute(httppost); jsonResult = inputStreamToString( response.getEntity()。getContent())。toString(); jsonResult = jsonResult。substring(6); ' –
コードを少し修正しました。あなたが現在POST要求を実行している方法では、ペイロードがないようです。 StringEntityはあなたのPOSTペイロード/ params(NameValuePairまたはJSONオブジェクト)を取り、それをUTFにエンコードします。 – fluffyBatman
ああ、申し訳ありませんが、言及を忘れてしまった。 params [0]はGET paramsとの完全なリンクです。 –