character-encoding

How do you echo a 4-digit Unicode character in Bash?

戏子无情 提交于 2019-12-28 01:38:28
问题 I'd like to add the Unicode skull and crossbones to my shell prompt (specifically the 'SKULL AND CROSSBONES' (U+2620)), but I can't figure out the magic incantation to make echo spit it, or any other, 4-digit Unicode character. Two-digit one's are easy. For example, echo -e "\x55", . In addition to the answers below it should be noted that, obviously, your terminal needs to support Unicode for the output to be what you expect. gnome-terminal does a good job of this, but it isn't necessarily

Converting byte array to String (Java)

╄→尐↘猪︶ㄣ 提交于 2019-12-27 17:06:47
问题 I'm writing a web application in Google app Engine. It allows people to basically edit html code that gets stored as an .html file in the blobstore. I'm using fetchData to return a byte[] of all the characters in the file. I'm trying to print to an html in order for the user to edit the html code. Everything works great! Here's my only problem now: The byte array is having some issues when converting back to a string. Smart quotes and a couple of characters are coming out looking funky. (?'s

PHP - Upload utf-8 filename

二次信任 提交于 2019-12-27 11:04:45
问题 I'm Vietnamese and i want to upload a utf-8 filename like Tên Tệp Tiếng Việt.JPG Here is my code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>utf-8</title> </head> <body> <?php if(isset($_POST["submit"])) { if($_FILES["upload"]["error"] > 0 ) echo "FILE ERROR!"; else { $base_dir = "D:/"; $fn

PHP - Convert ΓÇô to dash

孤街醉人 提交于 2019-12-27 00:56:30
问题 I found some special characters in my PHP script. One of them is ΓÇô . It's actually a special character of a dash - . How should I convert it back to dash so I can process the string? 回答1: I found the answer! It's inspired by this answer $title = "Hunting, Tactical & Outdoor Optics eCommerce Store ΓÇô $595,000 ΓÇö SOLD"; $title = str_replace(html_entity_decode('–', ENT_COMPAT, 'UTF-8'), '-', $title); $title = str_replace(html_entity_decode('—', ENT_COMPAT, 'UTF-8'), '-', $title); Replacing

If conditions with hebrew letter [duplicate]

拜拜、爱过 提交于 2019-12-25 20:29:09
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Split the first letter from variable i have code: if($firstletter=='I') { $picture = ImageCreateFromPNG ($global['maleBackgroundImages'][5]); } else { $picture = ImageCreateFromPNG ($global['maleBackgroundImages'][4]); } If I want to change the 'I' to hebrew letter how I do it? and if I want to check range $firstletter>a **and** $firstletter<b how I do it in the if? 回答1: Assuming UTF-8 character set $firstletter

If conditions with hebrew letter [duplicate]

浪尽此生 提交于 2019-12-25 20:28:04
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Split the first letter from variable i have code: if($firstletter=='I') { $picture = ImageCreateFromPNG ($global['maleBackgroundImages'][5]); } else { $picture = ImageCreateFromPNG ($global['maleBackgroundImages'][4]); } If I want to change the 'I' to hebrew letter how I do it? and if I want to check range $firstletter>a **and** $firstletter<b how I do it in the if? 回答1: Assuming UTF-8 character set $firstletter

Problems with charset, russian letters

南楼画角 提交于 2019-12-25 18:41:53
问题 I have a problem with charset. When im inserting values to table in russian letters it appears like this - Р?ван. This is my Database connection class. class Database { public $user = 'root'; public $password = ''; function __construct() { $this->connect(); } function connect() { try { $this->dbh = new PDO('mysql:host=localhost;dbname=university', $this->user, $this->password,array(PDO::MYSQL_ATTR_INIT_COMMAND=>'SET NAMES CP1251')); $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE

Encoding error, in python3

笑着哭i 提交于 2019-12-25 16:54:47
问题 I have a somewhat similar question here that I can't solve. In another instance of my code, I face similar encoding errors. Do assist! My code: port = serial.Serial("/dev/ttyUSB0", baudrate=9600, timeout=10, bytesize=8) f_w = open('/home/ryan/python_serial_output.txt','r+') f_o = open('/home/ryan/python_serial_parse.txt','w') port.send_break() sys_reply = port.read(100000) sys_reply_str = sys_reply.decode('utf-8') print(sys_reply_str) sys_reply_str_haha = sys_reply_str.replace("\r","") sys

I18N charset Encoding Spring-JSP

北战南征 提交于 2019-12-25 16:02:12
问题 I'm trying to show é as a title of my form:input field, and I can't get it working. Example 1 : <form:input type="text" path="something" title="é"/> Output : Example 2 : <input type="text" title="<spring:message code="mySpecialChar" />"/> Output : Example 3 : <form:input type="text" path="something" title="<spring:message code="mySpecialChar" />"/> Output : Error , I'm not allowed to do that, to solve this, I've tried Example 4. Example 4 : <spring:message code=mySpecialChar" var=

I18N charset Encoding Spring-JSP

人走茶凉 提交于 2019-12-25 16:02:08
问题 I'm trying to show é as a title of my form:input field, and I can't get it working. Example 1 : <form:input type="text" path="something" title="é"/> Output : Example 2 : <input type="text" title="<spring:message code="mySpecialChar" />"/> Output : Example 3 : <form:input type="text" path="something" title="<spring:message code="mySpecialChar" />"/> Output : Error , I'm not allowed to do that, to solve this, I've tried Example 4. Example 4 : <spring:message code=mySpecialChar" var=