character-encoding

Sending image as text in java

◇◆丶佛笑我妖孽 提交于 2019-12-23 18:40:10
问题 Is it possible to read image as text and send it over network? Is yes, then how can we do this? 回答1: You could base64 encode the image to produce a (text) string. Apache Commons Codec has a Base64 implementation that you can easily use: import org.apache.commons.codec.binary.Base64; // Read the byte array from file, DB, etc byte[] imageByteArray = getImageByteArray(); String base64Image = Base64.encodeBase64String(imageByteArray); 来源: https://stackoverflow.com/questions/6484002/sending-image

How do you convert an xml string with UTF-8 encoding UTF-16?

独自空忆成欢 提交于 2019-12-23 18:10:27
问题 For example, say I have the following xml in a string: <?xml version="1.0" encoding="UTF-8"?> <Stuff /> If I try to insert this into a SQL Server 2005 database table with an Xml column, I'll get the following error (I'm using EF 4.1, but I don't think that matters): XML parsing: line 1, character 38, unable to switch the encoding After doing some research, I learned that SQL Server expects the xml to be UTF-16. How do I convert it? 回答1: My first few attempts involved streams, byte arrays and

ObjectMapper Not Handling UTF-8 Properly?

给你一囗甜甜゛ 提交于 2019-12-23 18:04:12
问题 I'm using ObjectMapper to serialize posts in my system to json. These posts contain entries from all over the world and contain utf-8 characters. The problem is that the ObjectMapper doesn't seem to be handling these characters properly. For example, the string "Musée d'Orsay" gets serialized as "Mus?©e d'Orsay". Here's my code that's doing the serialization: public static String toJson(List<Post> posts) { ObjectMapper objectMapper = new ObjectMapper() .configure(Feature.USE_ANNOTATIONS, true

PHP DOMDocument saveHTML not encoding cyrillic correctly

浪子不回头ぞ 提交于 2019-12-23 17:50:18
问题 I use DOMDocument to manipulate html and php 7. The problem is that text shows good on page (cyrillic), but when I go to "See HTML page source", it is not good . It shows like this: Здесь осн What might be wrong? <meta> charset is utf-8. My code: $dom = new DOMDocument(); if (@$dom->loadHTML(mb_convert_encoding("<div>$body</div>", 'HTML-ENTITIES', 'UTF-8'), LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD)) { // https://stackoverflow.com/questions/29493678/loadhtml-libxml-html-noimplied-on-an

How to enforce internet explorer to use encoding given in meta tag?

♀尐吖头ヾ 提交于 2019-12-23 17:26:07
问题 I'm trying to prepare a demo html page with mixed english and arabic content. Basically it contains a small table with english phrases on the left, and the arabic translation on the right side. Because I don't understand arabic, I took the first three characters of the arabic alphabet from the Unicode reference. First attempt, using the character entities (ا ب ت): it works (display: ا ب ت). The I tried to enter the arabic characters directly in the document. To enable this, I saved the

How to HTML encode or transliterate “high” characters in Excel?

混江龙づ霸主 提交于 2019-12-23 16:05:54
问题 In Excel, how can I convert the contents of a cell which includes accented characters, curly quotes etc into either HTML for the same characters, OR a transliterated plaintext version? We have an XLS document which contains some "high" characters. The data has been pulled in via a DB connection, and it appears that Excel is correctly handling individual cells (or rows) being in different codepages. When we export this data to a CSV, some high characters are not correctly rendered - it appears

Problem when zipping files with special characters in PHP+Apache - encoding issue

被刻印的时光 ゝ 提交于 2019-12-23 15:51:05
问题 once again I am experiencing problems with encodings when trying to zip files in a PHP application. Here is the deal, whenever the file name contains special characters, i.e.: 'eñeìá.html', I am not able to zip it right.. the result of zipping it with the php function AddFile is 'e+¦e+¼+í.html' The problematic line is the following: $zip->addFile($file_to_add_path, $file_to_add->getFilename()); I have already tried using iconv, utf8_decode/encode, etc. but no luck yet. The closer I got was

Handler for fastcgi-script returned invalid result code

六眼飞鱼酱① 提交于 2019-12-23 15:26:02
问题 I have a strange question with PHP app connecting to a SOAP 1.2+WSDL service: Previous information: Apache server 2.4 with php5-fcgi module. I'm working on a client for a SOAP service, and I can do some request for the service. The request took some time to complete. I've needed to do a set_time_limit(60) because if I doesn't have it, the script return idle timeout error: FastCGI: comm with server "/usr/lib/cgi-bin/php5-fcgi" aborted: idle timeout (30 sec) With set_time_limit, i got another

How can I sort non-English strings in MySQL?

爱⌒轻易说出口 提交于 2019-12-23 15:03:39
问题 CREATE TABLE IF NOT EXISTS `gujarati` ( `name` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; INSERT INTO `gujarati` (`name`) VALUES ('ક'), ('દિનેશ'), ('ખા'), ('ગા'), ('થા'), ('થ'), ('કા'), ('મયૂર'), ('છત્ર'), ('ત્ર'), ('ક્ષ'), ('તા'), ('એક'), ('બોલ્ડ'), ('જ'), ('ટી'), ('મી'), ('હા'), ('યા'), ('ના'), ('ધી'), ('સો'), ('લા'), ('ઝા'), ('ણ્ણા'); This is my table that stores the Gujarati language. How can I sort this data in a MySQL

Accented/umlauted characters in C?

断了今生、忘了曾经 提交于 2019-12-23 13:58:10
问题 I'm just learning about C and got an assignment where we have to translate plain text into morse code and back. (I am mostly familiar with Java so bear with me on the terms I use). To do this, I have an array with the strings for all letters. char *letters[] = { ".- ", "-... ", "-.-. ", "-.. ", ".", "..-." etc I wrote a function for returning the position of the desired letter. int letter_nr(unsigned char c) { return c-97; } This is working, but the assignment specifications require the