utf-8

unable to encode special characters email in right format, gmail api & ae.net.mail

余生颓废 提交于 2021-01-28 03:08:25
问题 I'm working on an application that can send emails out with attachments and it works, until I try special characters æ, ø, å. I played a bit around testing different encodings and it looks like the subject is being encoded in ISO-8859-1 while the rest of the mail is encoded in UTF-8. Here is my method that generates a Google Gmail API message public Message CreateMessage(string to, string from, string body, string subject, GmailService service, string[] files = null, string bcc = null) { AE

Java UTF-8 encoding produces incorrect output

不想你离开。 提交于 2021-01-28 01:14:01
问题 In Java, I've been trying to write a String to a file using UTF-8 encoding which will later be read by another program written in a different programming language. While doing so I noticed that the bytes created when encoding a String into a byte array didn't seem to have the correct byte values. I narrowed down the problem to the symbol "£" which seems to produce incorrect bytes when encoded to UTF-8 byte[] byteArray = "£".getBytes(Charset.forName("UTF-8")); // Print out the Byte Array of

Python 3 itertools.islice continue despite UnicodeDecodeError

扶醉桌前 提交于 2021-01-28 00:01:03
问题 I have a python 3 program that monitors a log file. The log includes, among other things, chat messages written by users. The log is created by a third party application which I cannot change. Today a user wrote "텋��텋��" and it caused the program to crash with the following error: future: <Task finished coro=<updateConsoleLog() done, defined at /usr/local/src/bserver/logmonitor.py:48> exception=UnicodeDecodeError('utf-8',... say "\xed\xa0\xbd\xed\xb1\x8c"\r\n', 7623, 7624, 'invalid

How to put and get UTF-8 string from HTTP header with jersey?

社会主义新天地 提交于 2021-01-27 18:09:43
问题 I have a problem that I was asked to put some of the parameters into HTTP header of the request. The web server (with jersey 1.17) will parse the parameters from the header fields. However, the values of the parameters should be formed by UTF-8. Is it possible to put an UTF-8 string in the HTTP header? If it is possible, how can I simulate it using rest client (such as RESTClient in Firefox plugin)? I have tried to search for this question by google, and a question (What character encoding

How to Open File in UTF-8 and Write in Another File in UTF-16

北城余情 提交于 2021-01-27 13:02:39
问题 How can I open a file in UTF-8 and write to another file in UTF-16? I need an example because I'm having issues with some characters like 'é' and 'a'. When writing "médic", I find in the file written "m@#dic". 回答1: You can create a reader as follows: InputStream is = new FileInputStream(inputFile); InputStreamReader in = new InputStreamReader(is, "UTF-8"); and a writer as follows: OutputStream os = new FileOutputStream(outputFile); OutputStreamWriter out = new OutputStreamWriter(os, "UTF-16")

Windows Python: Changing encoding using the locale module

你说的曾经没有我的故事 提交于 2021-01-27 12:41:40
问题 Using Python 2.7 I am writing an abstract web scraper and am having problems when displaying (printing) certain characters. I get the trace-back error: UnicodeEncodeError: 'ascii' codec can't encode character u'\u2606' in position 5: ordinal not in range(128) from printing the string containing the character. I used the locale module to find out my OS supported settings, although I'm not certain I should use locale for my problem, and noticed the default settings where (en_US', 'cp1252') . I

Windows Python: Changing encoding using the locale module

陌路散爱 提交于 2021-01-27 12:40:50
问题 Using Python 2.7 I am writing an abstract web scraper and am having problems when displaying (printing) certain characters. I get the trace-back error: UnicodeEncodeError: 'ascii' codec can't encode character u'\u2606' in position 5: ordinal not in range(128) from printing the string containing the character. I used the locale module to find out my OS supported settings, although I'm not certain I should use locale for my problem, and noticed the default settings where (en_US', 'cp1252') . I

php-curl dosen't support utf-8 in url

自作多情 提交于 2021-01-27 12:20:37
问题 I am trying to send an http request from my server to another server in php. The url that I send the request to contains some utf8 characters for example http://www.aparat.com/etc/api/videoBySearch/text/نوروز . Here is my code: const api_adress = 'http://www.aparat.com/etc/api/'; const xml_config = 'http://www.aparat.com/video/video/config/videohash/[ID]/watchtype/site'; public function getDataInArray($JSON_ADRESS) { $json = json_decode(file_get_contents(self::api_adress . utf8_encode($JSON

Spring - Thymeleaf - Tomcat -> can not process UTF-8 character correctly

扶醉桌前 提交于 2021-01-27 06:52:41
问题 I am trying to display UTF-8 character in Spring-MVC web page. utf-8 values are coming from the database. I have already converted my database into utf-8. web services I have written is displaying the values as expected but, in the web page it is not showing the correct value. below is my spring configuration, please let me know what I am doing wrong. I am using thymeleaf as a templating engine: Thymeleafe configuration: <bean id="templateResolver" class="org.thymeleaf.templateresolver

Spring - Thymeleaf - Tomcat -> can not process UTF-8 character correctly

家住魔仙堡 提交于 2021-01-27 06:51:09
问题 I am trying to display UTF-8 character in Spring-MVC web page. utf-8 values are coming from the database. I have already converted my database into utf-8. web services I have written is displaying the values as expected but, in the web page it is not showing the correct value. below is my spring configuration, please let me know what I am doing wrong. I am using thymeleaf as a templating engine: Thymeleafe configuration: <bean id="templateResolver" class="org.thymeleaf.templateresolver