utf-8

Node Buffers, from utf8 to binary

谁都会走 提交于 2020-01-09 10:10:10
问题 I'm receiving data as utf8 from a source and this data was originally in binary form (it was a Buffer ). I have to convert back this data to a Buffer . I'm having a hard time figuring how to do this. Here's a small sample that shows my problem: var hexString = 'e61b08020304e61c09020304e61d0a020304e61e65'; var buffer1 = new Buffer(hexString, 'hex'); var str = buffer1.toString('utf8'); var buffer2 = new Buffer(str, 'utf8'); console.log('original content:', hexString); console.log('buffer1

How to parse line by line WinHTTP response: UTF-8 encoded CSV?

跟風遠走 提交于 2020-01-09 08:01:07
问题 As the next step for my happily solved problem (Not understanding why WinHTTP does NOT authenticate certain HTTPS resource) I need to prettily parse obtained CSV. At the moment I use the following solution: If HTTPReq.Status = 200 Then If FSO.FileExists(CSV_Path) = True Then FSO.DeleteFile (CSV_Path) Set FileStream = CreateObject("ADODB.Stream") FileStream.Open FileStream.Type = 1 FileStream.Write HTTPReq.responseBody FileStream.SaveToFile (CSV_Path) FileStream.Close ActiveWorkbook

Django fixture fails, stating “DatabaseError: value too long for type character varying(50)”

自作多情 提交于 2020-01-09 07:16:49
问题 I have a fixture (json) which loads in development environment but fails to do so in server environment. The error says: " DatabaseError: value too long for type character varying(50) " My development environment is Windows & Postgres 8.4. The server runs Debian and Postgres 8.3. Database encoding is UTF8 in both systems. It is as if unicode markers in the fixture count as chars on the server and they cause some strings to exceed their field's max length. However that does not happen in the

PDO::exec() or PDO::query()?

故事扮演 提交于 2020-01-09 06:19:50
问题 I used to have this as one of the options (4th param) passed to PDO constructor: $aOptions[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES utf8"; But just found that it does not work on certain php versions on Windows (does not work in 5.3) due to some bug. Now I need to run SET NAMES utf8 using either $pdo->exec("SET NAMES utf8"); or $pdo->query("SET NAMES utf8"); right after the instantiating the pdo object. So, which one should I use - exec() or query()? 回答1: When using PDO::EXEC the result

UTF-8 encoding in JSP page

只愿长相守 提交于 2020-01-08 21:01:29
问题 I have a JSP page whose page encoding is ISO-8859-1 . This JSP page there is in a question answer blog. I want to include special characters during Q/A posting. The problem is JSP is not supporting UTF-8 encoding even I have changed it from ISO-8859-1 to UTF-8 . These characters ( ~ , % , & , + ) are making problem. When I am posting these character either individually or with the combination of any character it is storinh null in the database and when I remove these characters while posting

Java - Convert String to valid URI object

杀马特。学长 韩版系。学妹 提交于 2020-01-08 16:01:30
问题 I am trying to get a java.net.URI object from a String . The string has some characters which will need to be replaced by their percentage escape sequences. But when I use URLEncoder to encode the String with UTF-8 encoding, even the / are replaced with their escape sequences. How can I get a valid encoded URL from a String object? http://www.google.com?q=a b gives http%3A%2F%2www.google.com... whereas I want the output to be http://www.google.com?q=a%20b Can someone please tell me how to

Getting the string length on UTF-8 in C? [closed]

拈花ヽ惹草 提交于 2020-01-07 07:56:11
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 years ago . Can this be done using a method similar to this one: As long as the current element of the string the user input via scanf is not \0, add one to the "length" int and then print out the length. I would be very grateful if anybody could guide me through the least complex way possible as I am a

Convert UTF8 strings in JSON to plain text iOS?

非 Y 不嫁゛ 提交于 2020-01-07 06:55:11
问题 Iam trying to display JSON list in UITableViewCell. When i parse my JSON i can see UTF8 characters and when i displaying UILabels the UTF8 string is displaying wrong value. This is my JSON file structure [{"name":"C\u0103r\u021bile pe fa\u021b\u0103 (Taxi Gratis)","code":"TX7","details":"tertert","costperkm":"ertrete","minimumcost":"tetret","taxicontact":[{"carrier":"ertertert","number":"ert"}],"taxistation":[{"stationname":"terterter","latitude":"tertert","longitude":"rete","details":

non ASCII SSIDs in android

最后都变了- 提交于 2020-01-07 06:14:06
问题 Apparently SSIDs can contain UTF-8 chars and also control characters etc. IIUC to contain UTF-8 chars they must specify the SSIDEncoding field. I was under the impression that I can only get ASCII bytes till now. How should I handle the situation in Android ? Namely, how can I check the SSIDEncoding field from the ScanResult ? Do I need to ? Also what does ScanResult.SSID contain in these cases ( including the case an SSID includes non printable characters ) ? Related Why can't I detect a

Page displaying '?', instead of 'é'

早过忘川 提交于 2020-01-07 05:46:06
问题 I am retriving data from oracle11g and displaying the data on IE8 and IE9 browser, but the couldn't display some special characters (eg. é) In my webpage, I have explicitly declare 'UTF-8' encoding. For my tomcat webserver, the server.xml <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" useBodyEncodingForURI="true"/> I read some other questions in stackflow, they mentioned to also ensure the database connection is using 'UTF-8' too.