encoding

UTF-8 encoding in JLabel on Windows

蓝咒 提交于 2020-01-06 08:14:15
问题 I have a problem with encoding in JLabel on Windows(on *nix OSes everything is okay). Here's an image: http://i.imgur.com/DEkj3.png (the problematic character is the L with ` on the top, it should be ł) and here the code: public void run() { URL url; HttpURLConnection conn; BufferedReader rd; String line; String result = ""; try { url = new URL(URL); conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); rd = new BufferedReader(new InputStreamReader(conn.getInputStream

UTF-8 encoding in JLabel on Windows

ぃ、小莉子 提交于 2020-01-06 08:14:00
问题 I have a problem with encoding in JLabel on Windows(on *nix OSes everything is okay). Here's an image: http://i.imgur.com/DEkj3.png (the problematic character is the L with ` on the top, it should be ł) and here the code: public void run() { URL url; HttpURLConnection conn; BufferedReader rd; String line; String result = ""; try { url = new URL(URL); conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); rd = new BufferedReader(new InputStreamReader(conn.getInputStream

Video onto a website without plugins

大兔子大兔子 提交于 2020-01-06 07:53:46
问题 After reading about MP4 and .ogv file conversions and all manner of video players, i'm really confused - I have read that HTML5 can be used to do this. My skills on the web are limited so any help would be great. I have a video file that I want to embed onto a website - it needs to be viewable on both IE and Safari and if possible WITHOUT the user needing to install plugins. What do I need to do to complete this / is there a way? Any insights / links would be really appreciated. Thanks! 回答1:

Jsp form encoding

戏子无情 提交于 2020-01-06 07:20:38
问题 I have a jsp page(let's say page1.jsp) which have an html form with action="page2.jsp". In page1.jsp and page2.jsp i have <%@page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%> outside the head section and <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> in the head section. If i write greek letters in the form i see in the url(get method) something like that http://localhost:8080//addProblem.jsp?lastNameForm=%CF%84%CF%85%CE%B8%CF%84%CF%85%CE%B8%CF%84%CF%85

Encoding issue of Euro sign

梦想的初衷 提交于 2020-01-06 06:44:53
问题 i have this code when i run it, it give me "?" instead of "€" (euro sign). Can anyone tell me what i can do to fix it. string Message = "Hello $ € £"; Encoding iso = Encoding.GetEncoding("ISO-8859-1"); Encoding utf8 = Encoding.UTF8; byte[] utfBytes = utf8.GetBytes(Message); byte[] isoBytes = Encoding.Convert(utf8, iso, utfBytes); string msg = iso.GetString(isoBytes); Console.WriteLine(msg); 回答1: string Message = "Hello $ € £"; Console.OutputEncoding = Encoding.UTF8; Console.WriteLine(Message)

json library interprets space characters as “\xa0”

孤街醉人 提交于 2020-01-06 06:05:54
问题 When I load a json-file into python there's no problem with encodings as long as the file is treated as a string. However, loading the file into json-format either using json.load on the file or json.loads on the string all space characters come out as "\xa0" The following code yields normal results, printing the json-string without any funky "\xa0" signs. with open(json_path) as f: lines = f.readlines() for line in lines: print(line) Loading the file into json-format and suddently space

How to Convert a javascript object to utf-8 Blob for download?

戏子无情 提交于 2020-01-06 04:33:48
问题 I've been trying to find a solution that works but couldn't find one. I have an object in javascript and it has some non-english characters in it. I'm trying the following code to convert the object to a blob for download. When I click to download the content, when opening the downloaded JSON the non-English characters are gibberish. It's a simple object like this one: {name: "שלומית", last: "רעננה"} function setJSONForDownload(obj) { obj = obj || []; // obj is the array of objects with non

How to parse an XML file with encoding declaration in Python?

前提是你 提交于 2020-01-06 04:18:23
问题 I have this XML file, called xmltest.xml : <?xml version="1.0" encoding="GBK"?> <productMeta> <bands>1,2,3,4</bands> <imageName>TestName.tif</imageName> <browseName>TestName.jpg</browseName> </productMeta> And I have this Python dummy code: import xml.etree.ElementTree as ET xmldoc = ET.parse('xmltest.xml') But it raises a ValueError : ValueError: multi-byte encodings are not supported I understand this error, it raises because the encoding declaration in the first line of the XML file. The

Convert text to Latin encoding and decode back problem for Vietnamese

孤街醉人 提交于 2020-01-06 04:01:59
问题 I'm trying to convert Vietnamese to Latin. It is a requirement to send the byte to ESC/P printer (see C# ESC/POS Print Vietnamese for reason why). But my question is very simple, look at this code: Encoding enc = Encoding.GetEncoding(1258); //vietnamese code page string content = "Cơm chiên với các loại gia vị truyền"; string newStr = Encoding.GetEncoding("Latin1").GetString(enc.GetBytes(content)); string origStr = enc.GetString(Encoding.GetEncoding("Latin1").GetBytes(newStr)); //origStr is

How to create a GSM-7 encoding in Python?

前提是你 提交于 2020-01-06 03:18:29
问题 The GSM-7 character set is defined as a basic mapping table + an extension character mapping table (https://en.wikipedia.org/wiki/GSM_03.38#GSM_7-bit_default_alphabet_and_extension_table_of_3GPP_TS_23.038_.2F_GSM_03.38). Meaning that u'@' should be mapped to b'\x00' (a byte string of length 1), but u'[' should be mapped to b'\x1b<' or b'\x1b\x3c' (a byte string of length 2). I've managed to get the encoding part to work by extending the encoding_table , but I'm not sure what to do that with