mdsami / android-query

Automatically exported from code.google.com/p/android-query
0 stars 0 forks source link

Need support HTML Encoding #10

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
use aq.ajax to download CHINESE html, it's a Big5 encoding string, not UTF8, i 
got garbled string.

Please support a parameter , It's like this :  aq.ajax(.....     ,    String 
encoding);

encoding can set "UTF-8"、 "Big5"、、、、or others....

In Others case, I got html encoded by "Big5", use this way:

HttpURLConnection conn = (HttpURLConnection) url.openConnection();
isr = new InputStreamReader(conn.getInputStream(), encoding );

Original issue reported on code.google.com by kny.c...@gmail.com on 22 Oct 2011 at 5:34

GoogleCodeExporter commented 8 years ago
Accepted.

Original comment by tinyeeliu@gmail.com on 24 Oct 2011 at 9:01

GoogleCodeExporter commented 8 years ago
Before this feature is implemented, you can do this:

    private void ajax_encoding(){

        String url = "http://www.kyotojp.com/limousine-big5.html";
        aq.ajax(url, byte[].class, this, "big5cb");

    }

    public void big5cb(String url, byte[] data, AjaxStatus status){

        if(data != null){
            String html = null;
            try {
                html = new String(data, "Big5");
            } catch (UnsupportedEncodingException e) {
            }
            AQUtility.debug(html);
        }

    } 

Original comment by tinyeeliu@gmail.com on 24 Oct 2011 at 9:27

GoogleCodeExporter commented 8 years ago
http://code.google.com/p/android-query/wiki/AsyncAPI?ts=1320931038&updated=Async
API#Encoding

Original comment by tinyeeliu@gmail.com on 10 Nov 2011 at 1:22