character-encoding

Garbled httpWebResponse string when posting data to web form programmatically

回眸只為那壹抹淺笑 提交于 2020-01-30 08:27:09
问题 I tried to search previous discussion about this issue but I didn't find one, maybe it's because I didn't use right keywords. I am writing a small program which posts data to a webpage and gets the response. The site I'm posting data to does not provide an API. After some Googling I came up to the use of HttpWebRequest and HttpWebResponse. The code looks like this: HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create("https://www.site.com/index.aspx"); CookieContainer cookie = new

PHP HTML Decode

杀马特。学长 韩版系。学妹 提交于 2020-01-30 06:42:50
问题 I'm forced to work with HTML that looks like this: <font color=3D=22=236EAED2=22 style=3D=22font-siz= e:13px;font-family:arial;=22><B>Some Info Here</B></font></= A></td></tr><tr><td><font color=3D=22=23FFFFFF=22 style=3D=22font-size:11= px;font-family:arial;=22>192 Wellington Parade =7C Melbourne =7C VIC =7C= Australia 3002</font></td></tr><tr><td><font color=3D=22=23FFFFFF=22 st= yle=3D=22font-size:11px;font-family:arial;=22>T: 61-<a href=3D=22=23=22 s= tyle=3D=22color:=23FFFFFF; text

Android : How to remove white spaces in Chinese characters?

我的梦境 提交于 2020-01-30 05:37:25
问题 I have a problem on trimming whitespaces in Chinese characters. I tried to log the content and here is how it looks like: When displaying it in textview, it does display Chinese characters but the problem is the whitespace before and after the string text. Can someone help me to encode/decode this? thanks in advance. EDIT 1 : Added screenshot of result. EDIT 2 : Added content charset in response. HttpProtocolParams.setContentCharset(params, HTTP.UTF_8); but I still get the square characters

Converting Mac Roman character to equivalent UTF-8

和自甴很熟 提交于 2020-01-30 04:51:33
问题 I have been given some HTML files that use the Mac OS Roman file encoding. The files have French text, but in an editor many of the diacritical chars look strange (i.e. non French) Si cette option est sÈlectionnÈe, <removed> tentera de communiquer avec votre tÈlescope seulement ‡ líaide díun ... The capital E with accent does display properly in the browser as é as do the other strange characters. I also have some UTF-8 French files that look normal in an editor (é looks like é). What I'd

How do you get the character appropriate for the given KeyDown event?

随声附和 提交于 2020-01-29 20:33:06
问题 How do you get the character appropriate for the given KeyDown event in WPF? 回答1: public enum MapType : uint { MAPVK_VK_TO_VSC = 0x0, MAPVK_VSC_TO_VK = 0x1, MAPVK_VK_TO_CHAR = 0x2, MAPVK_VSC_TO_VK_EX = 0x3, } [DllImport("user32.dll")] public static extern bool GetKeyboardState(byte[] lpKeyState); [DllImport("user32.dll")] public static extern uint MapVirtualKey(uint uCode, MapType uMapType); [DllImport("user32.dll")] public static extern int ToUnicode( uint wVirtKey, uint wScanCode, byte[]

a permanent way of doing mysqli->set_charset()?

泪湿孤枕 提交于 2020-01-29 00:52:15
问题 after setting all config file and runtime options for charset that i can find to utf-8, new mysqli connections made with php still has its charset set to latin1, which effectively means that i have to call $mysqli->set_charset('utf8') each time i connect. $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); if ($mysqli->connect_error) err_handle("mysql connect error({$mysqli->connect_errno})."); if (!$mysqli->set_charset("utf8")) err_handle("db error({$mysqli->errno})."); i wonder if

UTF-8 encoding in Spring MVC, problem with FORMs

做~自己de王妃 提交于 2020-01-27 03:21:05
问题 I have this in web.xml <filter> <filter-name>encoding-filter</filter-name> <filter-class> org.springframework.web.filter.CharacterEncodingFilter </filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>encoding-filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> and at the top of file.jsp

Text file encoding to UTF_8?

左心房为你撑大大i 提交于 2020-01-25 12:28:07
问题 I'm writing a Java project sending email with attachment. In my test case, I add some Japanese words "some Hiraganas and Katakanas" to my attached testfile.txt (which I saved in UTF-8 encoding.) But when I send my test email to myself, after I opened the attached testfile.txt, every Japanese Chars turns to be "????". So I'm just wondering why this happens...? Thank you Allan P.S. to be more specific, here is my code. I am using mail.jar to send email. Here is how I get the file: /** * Add an

MS Office hyperlinks change code page?

我的梦境 提交于 2020-01-25 09:39:04
问题 When you paste the following URL into IE: http://technet.microsoft.com/en-us/sysinternals/bb897434.aspx, the link on the right of the page cleanly says "Download Zoomit (77 KB)". If you paste the link into an Office document (Word, Excel, PowerPoint -- tested using Office 2003), and activate the link from the document, that same text has picked up a couple of A-circumflex symbols. This is because the source HTML contains " " entities (non-breaking space) which get translated to Unicode 00A0.

Android Chinese characters in WebView

眉间皱痕 提交于 2020-01-25 07:27:10
问题 I have a html code which I saved in home.txt file and placed it raw folder. Now I want to display the same in a WebView . I used the following code for it. homeWebview = (WebView) findViewById(R.id.homeWebview); InputStream fileStream = getResources().openRawResource(R.raw.home); int fileLen = fileStream.available(); // Read the entire resource into a local byte buffer. byte[] fileBuffer = new byte[fileLen]; fileStream.read(fileBuffer); fileStream.close(); displayText = new String(fileBuffer)