title: android sqlite with UTF-8 encoding
body: <p>Create table statement:  </p>
  
  <pre><code>CREATE TABLE product(id integer primary key, name VARCHAR(50), short_desc VARCHAR(100), full_desc VARCHAR(200), internet_url VARCHAR(70), local_url VARCHAR(70), file_name VARCHAR(50), view INT, sum_rating double, image_url VARCHAR(70), number_rating INT )
  </code></pre>
  
  <p>This is my code to insert product to sqlite:  </p>
  
  <pre><code>public void addListProduct(ArrayList&lt;ProductInfo&gt; productList) {
      SQLiteDatabase db = this.getWritableDatabase();
  
      ContentValues values = new ContentValues();
      for (ProductInfo product : productList) {
          values.put(KEY_ID, product.getProductId());
          values.put(NAME, product.getName());
          values.put(SHORT_DESC, product.getShortDesc());
          String full = "";
          try {
              full = new String(product.getFullDesc().getBytes(), "UTF-8");
          } catch (UnsupportedEncodingException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          values.put(FULL_DESC, full);
          values.put(INTERNET_URL, product.getInternetUrl());
          values.put(FILE_NAME, product.getFileName());
          values.put(VIEW, product.getView());
          values.put(SUM_RATING, product.getRating());
          values.put(IMAGE_URL, product.getImageUrl());
          values.put(NUMBER_RATING, product.getNumberOfRating());
  
          // insert row
          long indexProduct = db.insert(TABLE_PRODUCT, null, values);
          Log.i("Create product at ", "Create product at " + indexProduct);
      }
  
  }
  </code></pre>
  
  <p>Before I insert in the table:  </p>
  
  <pre><code>Làm sao web tôi được nhiều người biết đến?Làm như thế nào để người khác có thể tìm thấy website của tôi?Tôi tìm những từ khóa trên Google toàn thấy đối thủ cạnh tranh của mình. Làm sao để mình có thể xuất hiện như vậy?Cách làm SEO như thế nào? 
  </code></pre>
  
  <p>But when get from sqlite: It become:  </p>
  
  <pre><code>L?m sao web t?i ???c nhi?u ng??i bi?t ??n?L?m nh? th? n?o ?? ng??i kh?c c? th? t?m th?y website c?a t?i?T?i t?m nh?ng t? kh?a tr?n Google to?n th?y ??i th? c?nh tranh c?a m?nh. L?m sao ?? m?nh c? th? xu?t hi?n nh? v?y?C?ch l?m SEO?nh? th? n?o? 
  </code></pre>
  
  <p>GetAllProduct:  </p>
  
  <pre><code>public List&lt;ProductInfo&gt; getAllProduct() {
      List&lt;ProductInfo&gt; list = new ArrayList&lt;ProductInfo&gt;();
      String selectQuery = "SELECT  * FROM " + TABLE_PRODUCT;
  
      Log.e("query", selectQuery);
  
      SQLiteDatabase db = this.getReadableDatabase();
      Cursor c = db.rawQuery(selectQuery, null);
  
      // looping through all rows and adding to list
      if (c.moveToFirst()) {
          ProductInfo product;
          do {
              product = new ProductInfo();
              product.setProductId(c.getString(c.getColumnIndex(KEY_ID)));
              product.setName(c.getString(c.getColumnIndex(NAME)));
              String shorDesc = "";
              String fullDesc = "";
              try {
                  shorDesc = new String(c.getString(
                          c.getColumnIndex(SHORT_DESC))
                          .getBytes("ISO-8859-1"), "UTF-8");
  
                  fullDesc = new String(
                          c.getString(c.getColumnIndex(FULL_DESC)).getBytes(
                                  "ISO-8859-1"), "UTF-8");
              } catch (UnsupportedEncodingException e) {
                  e.printStackTrace();
              }
              product.setShortDesc(shorDesc);
              product.setFullDesc(fullDesc);
  
              product.setLocalUrl(c.getString(c.getColumnIndex(LOCAL_URL)));
              product.setInternetUrl(c.getString(c
                      .getColumnIndex(INTERNET_URL)));
              product.setFileName(c.getString(c.getColumnIndex(FILE_NAME)));
              product.setImageUrl(c.getString(c.getColumnIndex(IMAGE_URL)));
              // product.setCategory(c.getString(c.getColumnIndex(NAME)));
              product.setView(c.getInt(c.getColumnIndex(VIEW)));
              product.setRating(c.getInt(c.getColumnIndex(NUMBER_RATING)));
              product.setNumberOfRating(c.getInt(c
                      .getColumnIndex(NUMBER_RATING)));
              list.add(product);
          } while (c.moveToNext());
  
      }
      Log.i("Number of record ", list.size() + "");
      return list;
  }
  </code></pre>