encoding

Is there any difference between a .json, .txt, .html, .css, and .js file other than the extension?

核能气质少年 提交于 2019-12-23 12:27:47
问题 The impetus is: I have some JSON that I've been saving as .txt files for a bit. I'd like to rename them all to .json to be more accurate. I'm pretty sure they are both UTF-8, as are most files that can be sent over Ajax. Anyways, this question raised a bigger question. Is there any real difference between all of these text types, other than the extension? .html, .json, .css, .js, .txt, .py, etc... they all appear to be the same thing on the inside: a UTF-8 character array. If you used these

Error Parsing due to CSV Differences Before/After Saving (Java w/ Apache Commons CSV)

对着背影说爱祢 提交于 2019-12-23 12:18:08
问题 I have a 37 column CSV file that I am parsing in Java with Apache Commons CSV 1.2. My setup code is as follows: //initialize FileReader object FileReader fileReader = new FileReader(file); //intialize CSVFormat object CSVFormat csvFileFormat = CSVFormat.DEFAULT.withHeader(FILE_HEADER_MAPPING); //initialize CSVParser object CSVParser csvFileParser = new CSVParser(fileReader, csvFileFormat); //Get a list of CSV file records List<CSVRecord> csvRecords = csvFileParser.getRecords(); // process

“uninitialized constant Encoding” using rvm, ruby 1.9.2, bundler and passenger

大城市里の小女人 提交于 2019-12-23 11:45:12
问题 I am at wit's end here and am turning to you all for some help on this f*#$^ encoding issue. I am running on a private server with root permissions on Dreamhost. Here is a bit about my environment and versions. $ `which ruby` -v ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux] $ `which bundle` -v Bundler version 1.0.15 $ `which rails` -v Rails 3.0.9 Aside from this error, my rails app runs fine without issue. However, when I try to change the encoding a string by using the encode

“uninitialized constant Encoding” using rvm, ruby 1.9.2, bundler and passenger

蓝咒 提交于 2019-12-23 11:45:04
问题 I am at wit's end here and am turning to you all for some help on this f*#$^ encoding issue. I am running on a private server with root permissions on Dreamhost. Here is a bit about my environment and versions. $ `which ruby` -v ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux] $ `which bundle` -v Bundler version 1.0.15 $ `which rails` -v Rails 3.0.9 Aside from this error, my rails app runs fine without issue. However, when I try to change the encoding a string by using the encode

How can I find extended ASCII characters in a file using Perl?

社会主义新天地 提交于 2019-12-23 10:51:02
问题 How can I find extended ASCII characters in a file using Perl? Can anyone get the script? .....thanks in advance..... 回答1: Since the extended ASCII characters have value 128 and higher, you can just call ord on individual characters and handle those with a value >= 128. The following code reads from stdin and prints only the extended ASCII characters: while (<>) { while (/(.)/g) { print($1) if (ord($1) >= 128); } } Alternatively, unpack together with chr will also work. Example: while (<>) {

How do I write a plot containing a symbol to PDF in R?

南楼画角 提交于 2019-12-23 10:26:24
问题 I want to use the infinity sign on the x-axis of a box plot in R, which I want to write to a PDF file. I can set the infinity symbol by doing names(data)[9] <- "∞" but that gets me encoding errors when trying to write: conversion failure on '∞' in 'mbcsToSbcs': dot substituted for <...> 回答1: You can either use Unicode as in this example: using Unicode 'dingbat-like' glyphs in R graphics, across devices & platforms, especially PDF (infinity is Unicode 8734): in particular, it's possible that

Displaying ® symbol in Silverlight

人走茶凉 提交于 2019-12-23 09:58:07
问题 Folks! I am trying to display ® and superscript TM symbols in my silverlight app. I want to save the text containing the symbols in a resx file. Things i have tried: Copy paste the ® symbol from any document to resx file. ® symbol gets displayed in the resx file. But, when running the silverlight app, xamlparseexception is thrown. Use unicode text &#174 instead of ® symbol in the resx file. Same xamlparseexception thrown. My resx file encoding is utf-8. Appreciate your thoughts! EDITED:

PHP internal encoding

南笙酒味 提交于 2019-12-23 09:48:58
问题 According to bin2hex my PHP is internally using UTF-8: echo bin2hex("ö"); -> c3b6 (utf-8) echo bin2hex(utf8_decode("ö")); -> f6 (ISO-8859) But both mb_internal_encoding() and iconv_get_encoding() say it is ISO-8859-1. echo mb_internal_encoding(); -> ISO-8859-1 var_dump(iconv_get_encoding()); -> ["input_encoding"]=> string(10) "ISO-8859-1" ["output_encoding"]=> string(10) "ISO-8859-1" ["internal_encoding"]=> string(10) "ISO-8859-1" UTF-8 seems to apparently be the one it's using, but why is it

Can Encode::Guess tell utf-8 from iso-8859-1?

寵の児 提交于 2019-12-23 09:37:20
问题 I have a string $data, encoded in utf-8. I assume that I don't know whether this string is utf-8 or iso-8859-1. I want to use the Perl Encode::Guess module to see if it's one or the other. I'm having trouble figuring out how this module works. I have tried the four following methods (from http://perldoc.perl.org/Encode/Guess.html) : use Encode::Guess qw/utf8 latin1/; my $decoder = guess_encoding($data); print "$decoder\n"; Result: iso-8859-1 or utf8 use Encode::Guess qw/utf8 latin1/; my $enc

Werkzeug raises BrokenFilesystemWarning

筅森魡賤 提交于 2019-12-23 09:36:23
问题 I get the following error when I send form data to my Flask app. It says it will use the UTF-8 encoding, but the locale is already UTF-8. What does this error mean? /home/.virtualenvs/project/local/lib/python2.7/site-packages/werkzeug/filesystem.py:63: BrokenFilesystemWarning: Detected a misconfigured UNIX filesystem: Will use UTF-8 as filesystem encoding instead of 'ANSI_X3.4-1968' $ locale LANG=en_US.utf8 LANGUAGE=en_US.utf8 LC_CTYPE="en_US.utf8" LC_NUMERIC="en_US.utf8" LC_TIME="en_US.utf8"