小编Ale*_*les的帖子

Java UTF-8编码未设置为URLConnection

我正在尝试从http://api.freebase.com/api/trans/raw/m/0h47中检索数据

你可以在文字中看到有这样的歌: /æl?d???ri?/.

当我尝试从页面获取源代码时,我会收到类似唱歌的文字等ú.

到目前为止,我已尝试使用以下代码:

urlConnection.setRequestProperty("Accept-Charset", "UTF-8");
urlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

我的整个代码:

URL url = null;
URLConnection urlConn = null;
DataInputStream input = null;
try {
url = new URL("http://api.freebase.com/api/trans/raw/m/0h47");
} catch (MalformedURLException e) {e.printStackTrace();}

try {
    urlConn = url.openConnection(); 
} catch (IOException e) { e.printStackTrace(); }
urlConn.setRequestProperty("Accept-Charset", "UTF-8");
urlConn.setRequestProperty("Content-Type", "text/plain; charset=utf-8");

urlConn.setDoInput(true);
urlConn.setUseCaches(false);

StringBuffer strBseznam = new StringBuffer();
if (strBseznam.length() > 0)
    strBseznam.deleteCharAt(strBseznam.length() - 1);

try {
    input = new DataInputStream(urlConn.getInputStream()); 
} catch (IOException e) …
Run Code Online (Sandbox Code Playgroud)

java unicode utf8-decode

11
推荐指数
2
解决办法
4万
查看次数

在同一个放射组中水平和垂直对齐单选按钮

我想在一个radiogroup中有单选按钮分为2列和几行.

到目前为止,我已经能够通过将LinearLayouts放在radiogroup中来划分它们.问题是当我点击它们时它们不是独占的(我可以同时检查所有这些).有没有办法让它们独占(除了程序化的方式)?

android

4
推荐指数
2
解决办法
1万
查看次数

PHP使用数据透视表将数据导出到xls

如何将PHP中的数据导出到也具有数据透视表的Excel电子表格?有没有关于它的好教程?谢谢

php excel pivot-table

3
推荐指数
1
解决办法
4245
查看次数

在表内形成

为什么这是错的?

<table>
  <form>
    <tr><td>something something</td/>
  </form>
</table>
Run Code Online (Sandbox Code Playgroud)

我在谈论表标签内的表单标签的位置.

forms

2
推荐指数
1
解决办法
1745
查看次数

普通JavaScript等于jquery $(this)

我目前有链接的jQuery代码.单击选定的链接时,将打开对话框.

$('.dialog_link_add').click(function(){
    var row_id = $(this).parent().parent().attr('id');
    return false;
}
Run Code Online (Sandbox Code Playgroud)

因为对话框总是使窗口滚动到顶部(在Internet Explorer中),我通过使用纯JavaScript并使用旧的方式实现方法找到了解决方案.

onclick="function_call(this);return false;"
Run Code Online (Sandbox Code Playgroud)

......但它不起作用.我现在如何发送"this"参数等于jQuery $(this)?

javascript jquery this

-1
推荐指数
1
解决办法
85
查看次数

标签 统计

android ×1

excel ×1

forms ×1

java ×1

javascript ×1

jquery ×1

php ×1

pivot-table ×1

this ×1

unicode ×1

utf8-decode ×1