encoding

Using aws-sdk to download files from s3. Encoding not right

Deadly 提交于 2020-01-15 11:28:08
问题 I am trying to use aws-sdk to load s3 files to local disk, and question why my pdf file (which just has a text saying SAMPLE PDF) turns out with an apparently empty content. I guess it has something to do with the encoding...but how can i fix it? Here is my code : require 'aws-sdk' bucket_name = "****" access_key_id = "***" secret_access_key = "**" s3=AWS::S3.new( access_key_id: access_key_id, secret_access_key: secret_access_key) b = s3.buckets[bucket_name] filen = File.basename("Sample.pdf"

Ruby 1.9 + Net::FTP => Encoding::UndefinedConversionError

橙三吉。 提交于 2020-01-15 11:25:08
问题 i upgraded from Ruby 1.8.7 to 1.9.2 (and Rails 3.2.2) and have the problem that Net::FTP#gettextfile is throwing an Encoding::UndefinedConversionError I'm trying to download a xml file which is encoded as utf-8. The dowload works fine if i use getbinaryfile, but i would like to understand why gettextfile is not working. # -*- encoding : utf-8 -*- # working ftp = Net::FTP.open(host,user,password) ftp.passive = true ftp.getbinaryfile("some.xml","tmp/some.xml") # not working ftp = Net::FTP.open

The apostrophes are not displayed when getting data from MySQL into bootstrap table

人走茶凉 提交于 2020-01-15 11:06:23
问题 When I execute SELECT query in php in order to get data from MySQL DB into bootstrap table, the apostrophes are not displayed correctly in the table rows. In particular, I get Gr�a instead of Grúa . This is how I get data from MySQL DB: <?php include_once 'include/connect_db.php'; $query = "SELECT * FROM myTable;"; $result = ejecutar_query($query); $list = array(); while ($b = mysqli_fetch_array($result)) { $list[] = $b; } ?> <td><?php echo $row['name'];?></td> <!--jQuery Datatable--> <script

The apostrophes are not displayed when getting data from MySQL into bootstrap table

♀尐吖头ヾ 提交于 2020-01-15 11:04:27
问题 When I execute SELECT query in php in order to get data from MySQL DB into bootstrap table, the apostrophes are not displayed correctly in the table rows. In particular, I get Gr�a instead of Grúa . This is how I get data from MySQL DB: <?php include_once 'include/connect_db.php'; $query = "SELECT * FROM myTable;"; $result = ejecutar_query($query); $list = array(); while ($b = mysqli_fetch_array($result)) { $list[] = $b; } ?> <td><?php echo $row['name'];?></td> <!--jQuery Datatable--> <script

How to get the HTML encoding right in C#?

非 Y 不嫁゛ 提交于 2020-01-15 10:49:05
问题 I'm trying to get the pronunciation for certain word from a web dictionary. For example, in the following code, I want to get the pronunciation of good from http://collinsdictionary.com ( HTTP Agility Pack is used here) static void test() { String url = "http://www.collinsdictionary.com/dictionary/english/good"; WebClient client = new WebClient(); client.Encoding = System.Text.Encoding.UTF8; String html = client.DownloadString(url); HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack

ASN Basic Encoding Rule of an integer

三世轮回 提交于 2020-01-15 10:37:32
问题 I'm currently studying the Abstract Syntax Notation One and reading the ITU-T Recommendation X.690. On page 15 in paragraph 8.3.2, there is written: If the contents octets of an integer value encoding consist of more than one octet, then the bits of the first octet and bit 8 of the second octet: shall not all be ones; and shall not all be zero. NOTE – These rules ensure that an integer value is always encoded in the smallest possible number of octets. I understand that for the integer to be

Mangling of French unicode when webscraping with rvest

只谈情不闲聊 提交于 2020-01-15 06:40:11
问题 I'm looking at scraping a French website using the rvest package. library(rvest) url <- "https://www.vins-bourgogne.fr/nos-vins-nos-terroirs/tous-les-bourgognes/toutes-les-appellations-de-bourgogne-a-votre-portee,2378,9172.html?&args=Y29tcF9pZD0xMzg2JmFjdGlvbj12aWV3RnVsbExpc3RlJmlkPSZ8" s <- read_html(url) s %>% html_nodes('#resultatListeAppellation .lien') %>% html_text() I expect to see: Aloxe-Corton (Appellation Village, VIGNOBLE DE LA CÔTE DE BEAUNE) Auxey-Duresses (Appellation Village,

Chinese encoding issue while listing files

旧城冷巷雨未停 提交于 2020-01-15 03:05:57
问题 I am running a Java application on a Solaris10 with Chinese . Now there are some files in a directory with chinese filenames. When I do files = new File(dir).list() where "dir" is the parent directory containing that chinese file, I get the result filename files[0] as ????? (some junk characters). Now the deal is that my programs file.encoding property is already set to GBK and I also do Charset.isSupported("GBK") and it returns true too. So where could be the problem. I am running out of

sqllite query with encrypted std::string (unrecognized token)

被刻印的时光 ゝ 提交于 2020-01-14 22:51:30
问题 I have a C++ std::string which is encrypted using AES128 and want to write it into a sqllite database. I figured out already, that I have to escape ' characters with '' and " with "" , but there seems to be another problem. It says: unrecognized token: "'""\235\211g\264\376\247\3348( ]tu\202\346\360\226h\205D\322-\373\347y" My query looks like: UPDATE tablename SET column='""\235\211g\264\376\247\3348( ]tu\202\346\360\226h\205D\322-\373\347y\315\|`\3206\245\220j6 \215&\301ww/\222R\352]\253,

Stream/string/bytearray transformations in Python 3

孤街浪徒 提交于 2020-01-14 22:42:30
问题 Python 3 cleans up Python's handling of Unicode strings. I assume as part of this effort, the codecs in Python 3 have become more restrictive, according to the Python 3 documentation compared to the Python 2 documentation. For example, codecs that conceptually convert a bytestream to a different form of bytestream have been removed: base64_codec bz2_codec hex_codec And codecs that conceptually convert Unicode to a different form of Unicode have also been removed (in Python 2 it actually went