utf-8

Convert html entities to UTF-8, but keep existing UTF-8

旧时模样 提交于 2021-02-10 11:45:11
问题 I want to convert html entities to UTF-8, but mb_convert_encoding destroys already UTF-8 encoded characters. Whats the correct way? $text = "äöü ä ö ü ß"; var_dump(mb_convert_encoding($text, 'UTF-8', 'HTML-ENTITIES')); // string(24) "äöü ä ö ü ß" 回答1: mb_convert_encoding() isn't the correct function for what you're trying to achieve: you should really be using html_entity_decode() instead, because it will only convert the actual html entities to UTF-8, and won't affect the existing UTF-8

PHP, mysql encoding UTF-8

梦想与她 提交于 2021-02-09 12:27:36
问题 I'm making basic PHP & MySQL searching. Our country usually use character encoding which is utf-8 or euc-kr . when I input the keyword that is English, the result is shown well. but, input the Korean keyword, the result doesn't shown on the screen. (result count doesn't shown) I'm coding on Eclipse PDT, every html,php document's encodings are EUC-KR. I set up property. and MySQL's table collation is euckr_korean. I don't know what to do. I'm newbie on php. Code is simple. there are 2 document

Python encoded utf-8 string \xc4\x91 in Java

匆匆过客 提交于 2021-02-08 13:46:14
问题 How to get proper Java string from Python created string 'Oslobo\xc4\x91enja'? How to decode it? I've tryed I think everything, looked everywhere, I've been stuck for 2 days with this problem. Please help! Here is the Python's web service method that returns JSON from which Java client with Google Gson parses it. def list_of_suggestions(entry): input = entry.encode('utf-8') """Returns list of suggestions from auto-complete search""" json_result = { 'suggestions': [] } resp = urllib2.urlopen(

python 3.4 encoding in windows 8.1

匆匆过客 提交于 2021-02-08 10:33:12
问题 I use the script mentioned in this question, to check the encoding: import sys, locale, os print(sys.stdout.encoding) print(sys.stdout.isatty()) print(locale.getpreferredencoding()) print(sys.getfilesystemencoding()) print(os.environ["PYTHONIOENCODING"]) print(chr(246), chr(9786), chr(9787)) and I obtain (python 3.4, windows 8.1): windows-1252 False cp1252 mbcs windows-1252 ö Traceback (most recent call last): File "C:/Users/.../UTF8-comprovacio.py", line 8, in <module> print(chr(246), chr

Ruby 1.9.3 Invalid byte sequence in UTF-8 explanation needed

懵懂的女人 提交于 2021-02-08 09:30:08
问题 I installed RVM and Ruby through Cygwin on Windows 7. I am now trying to install Omega bundle following this guide. The command is bundle install Which gives an error 'command not found'. The solution for this is to install bundler via gem install bundler But this gives an 'Invalid byte sequence in UTF-8 error'. The solution for this is described in this post. But I don't understand where I should place this snippet. require 'iconv' unless String.method_defined?(:encode) if String.method

Python - decode ('utf-8') issue

这一生的挚爱 提交于 2021-02-08 07:41:13
问题 I am very new to Python.Please help me fix this issue. I am trying to get the revenue from the link below : https://www.google.co.in/?gfe_rd=cr&ei=kFFsWYyPEqvM8AeF7Y2IDQ&gws_rd=ssl#q=adp+revenue&stick=H4sIAAAAAAAAAOPgE-LUz9U3MMkozijTUskot9JPzs_JSU0uyczP088vSk_My6xKBHGKrYpSy1LzSlMBIRiSrDMAAAA&spf=1500270991898 I am using below commands : import re import urllib.request data=urllib.request.urlopen(url).read() data1=data.decode("utf-8") Issue : UnicodeDecodeError: 'utf-8' codec can't decode byte

Python - decode ('utf-8') issue

心不动则不痛 提交于 2021-02-08 07:41:09
问题 I am very new to Python.Please help me fix this issue. I am trying to get the revenue from the link below : https://www.google.co.in/?gfe_rd=cr&ei=kFFsWYyPEqvM8AeF7Y2IDQ&gws_rd=ssl#q=adp+revenue&stick=H4sIAAAAAAAAAOPgE-LUz9U3MMkozijTUskot9JPzs_JSU0uyczP088vSk_My6xKBHGKrYpSy1LzSlMBIRiSrDMAAAA&spf=1500270991898 I am using below commands : import re import urllib.request data=urllib.request.urlopen(url).read() data1=data.decode("utf-8") Issue : UnicodeDecodeError: 'utf-8' codec can't decode byte

Is there any way to specify the encoding used in SpreadsheetGear to generate CSV files?

自作多情 提交于 2021-02-08 06:39:39
问题 I am trying to export data containing Unicode characters from our system using Spreadsheet Gear to csv format. (Fine for excel). However because the CSV format is not UTF-8 encoded all the Unicode characters are exported as ??? I am aware that Spreadsheet Gear supports Unicode by having a tab-delimited UTF-8 text file, however we require the comma-delimited file. This is what currently exists (including my check that the Unicode Text file format exports the characters correctly): public

What is the Windows command line parameter encoding?

爷,独闯天下 提交于 2021-02-08 05:57:12
问题 What encoding does Windows use for command line parameters passed to programs started in a cmd.exe window? The encoding of command line parameters doesn't seem to be affected by the console code page set using chcp (I set it to UTF-8, code page 65001 and use the Lucida Console font.) If I paste an EN DASH, encoded as hex E28093, from a UTF-8 file into a command line, it is displayed correctly in the cmd.exe window. However, it seems to be translated to a hex 96 (an ANSI representation) when

Determining text file encoding schema

僤鯓⒐⒋嵵緔 提交于 2021-02-08 05:03:35
问题 I am trying to create a method that can detect the encoding schema of a text file. I know there are many out there, but I know for sure my text file with be either ASCII , UTF-8 , or UTF-16 . I only need to detect these three. Anyone know a way to do this? 回答1: Use the StreamReader to identify the encoding. Example: using(var r = new StreamReader(filename, Encoding.Default)) { richtextBox1.Text = r.ReadToEnd(); var encoding = r.CurrentEncoding; } 回答2: First, open the file in binary mode and