iso-8859-1

Python3 different behaviour between latin-1 and cp1252 when decoding unmapped characters

老子叫甜甜 提交于 2021-02-10 16:59:59
问题 I'm trying to read in Python3 a text file specifying encoding cp1252 which has unmapped characters (for instance byte 0x8d ). with open(inputfilename, mode='r', encoding='cp1252') as inputfile: print(inputfile.readlines()) I obviously get the following exception: Traceback (most recent call last): File "test.py", line 9, in <module> print(inputfile.readlines()) File "/usr/lib/python3.6/encodings/cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0]

Python3 different behaviour between latin-1 and cp1252 when decoding unmapped characters

拥有回忆 提交于 2021-02-10 16:59:33
问题 I'm trying to read in Python3 a text file specifying encoding cp1252 which has unmapped characters (for instance byte 0x8d ). with open(inputfilename, mode='r', encoding='cp1252') as inputfile: print(inputfile.readlines()) I obviously get the following exception: Traceback (most recent call last): File "test.py", line 9, in <module> print(inputfile.readlines()) File "/usr/lib/python3.6/encodings/cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0]

XmlDocument with Kanji text content is not encoded correctly to ISO-8859-1 using XmlTextWriter

别来无恙 提交于 2021-01-28 05:35:53
问题 I have an XmlDocument that includes Kanji in its text content, and I need to write it to a stream using ISO-8859-1 encoding. When I do, none of the Kanji characters are encoded properly, and are instead replaced with "??". Here is sample code that demonstrates how the XML is written from the XmlDocument : MemoryStream mStream = new MemoryStream(); Encoding enc = Encoding.GetEncoding("ISO-8859-1"); XmlTextWriter writer = new XmlTextWriter(mStream,enc); doc.WriteTo(writer); writer.Flush();

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

MySQL - select first 10 bytes of a string

混江龙づ霸主 提交于 2021-01-27 21:28:38
问题 Hello wise men & women, How would you select the first x bytes of a string? The use case: I'm optimizing product description texts for upload to Amazon, and Amazon measures field lengths by bytes in utf8 (not latin1 as I stated earlier), not by characters. MySQL on the other hand, seems to operate character-based. (e.g., the function left() is character-based, not byte-based). The difference (using English, French, Spanish & German) is roughly 10%, but it can vary widely. Some tests

解决Python库Requests中文乱码

眉间皱痕 提交于 2020-03-17 01:46:48
当使用Python库requests进行网络请求的时候: r = requests . get ( url ) 1 使用 r.text返回的是Unicode型的数据。 r.content返回的是bytes型的数据。 如果你想取文本,使用r.text。 如果想取图片,文件,则可以通过r.content。 2 Requests库的自身编码为: r.encoding = ‘ISO-8859-1’ 修改编码: r . encoding = 'utf-8' r . text 来源: CSDN 作者: LU_ZHAO 链接: https://blog.csdn.net/LU_ZHAO/article/details/104859403

jsp第一个作业

限于喜欢 提交于 2020-03-09 17:32:11
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>Insert title here</title> </head> <body> <h1>Helle Word!!</h1> </body> </html> 来源: https://www.cnblogs.com/zqxxx/p/12449630.html

easyUi 的form和validate组件

[亡魂溺海] 提交于 2020-02-14 23:09:06
以下代码不能运行,只是我在学习过程中记录的笔记,但代码可以用!!! 可以按照需要截取。 <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>Insert title here</title> <script type="text/javascript"> //ajax的提交方式 $.ajax({ //提交的资源地址 url:'UserController/login', //向资源地址提交的数据 serialize()方法会自动的列出表单中的数据 data:$("#loginInputForm").serialize(), cache:false, //服务器端返回的数据类型 dataType:'json', //服务器端执行成功后的回调函数 success:function(r){ //将json形式的字符串转化为json对象 // r=eval("("+r+")"); //javascript $.parseJSON(r); //jQuery //登陆成功 if(r&&r.success){ /

ssm_支付宝沙箱

僤鯓⒐⒋嵵緔 提交于 2020-01-27 22:20:29
支付宝配置: package alipay; import java.io.FileWriter; import java.io.IOException; /** * Created by Administrator on 2019/7/6. */ public class AlipayConfig { // ↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ // 应用ID,您的APPID,收款账号既是您的APPID对应支付宝账号 public static String app_id = "2016100100636987";//例:2016082600317257 // 商户私钥,您的PKCS8格式RSA2私钥 public static String merchant_private_key ="MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCQ4JdtPp86OXH26BFAlfoQF/zk66lsTzUrRBOm7HqCwfxLTFvRffhS/UHBwpETySYbpiuAxfnKgsnP+AdrfPetpsAPhQf7IYfQTcdAoWJLP3j3+2emAYGRmUCcyehR3oCmQNeXg8el6kD8bMiG+sgVYCMsUcd0T49kfd85NBaMV1rtW

Is iso-8859-1 supported in Silverlight?

℡╲_俬逩灬. 提交于 2020-01-25 10:08:08
问题 this is a simple question: does Silverlight (3.0?) support this kind of encoding? Encoding c = Encoding.GetEncoding("iso-8859-1"); Calling this function in Silverlight 3.0 generate the following error. 'ISO-8859-1' is not a supported encoding name. Parameter name: name My idea is to parse some file client side and then upload only those part needed for my application. I know that I could upload the whole file and parse it server side but right now could be better having the feature client