encoding

How to config spring boot application to support both UTF-8 and GBK encode?

╄→гoц情女王★ 提交于 2019-12-25 07:26:09
问题 I am using spring boot in my project and I run some encoding issue. In the project, there is a controller(below) which accept request with a content type header ,"application/x-www-form-urlencoded;charset=GBK". @RequestMapping(value = "/notify",headers ={"Content-Type=application/x-www-form-urlencoded;charset=GBK"} , method = RequestMethod.POST, produces = "application/x-www-form-urlencoded; charset=GBK") public ResponseEntity<String> notify(@RequestParam(name = "p") String plain,

Why does Python write one wrongly encoded line every two lines?

孤者浪人 提交于 2019-12-25 07:10:02
问题 I am trying to dump the content of a table column from SQL Server 2K into text files, that I want to later treat with Python and output new text files. My problem is that I can't get python to use the correct encoding, and while the input files appear fine on my text editor the output ones have broken characters apparently once every two lines. My python code can be reduced to: input = open('input', 'r') string = input.read() # Do stuff output = open('output', 'w+') output.write(string)

C# URLDecode turns %5C into \\\\ instead of \

醉酒当歌 提交于 2019-12-25 07:01:25
问题 I have a web service method that takes a network login (string) as a parameter. The login is URL Encoded from JavaScript so the DOMAIN\USERNAME is encoded into DOMAIN%5CUSERNAME. When I use the HttpUtility.URLDecode on the string, it escapes the backslash and gives me DOMAIN\\USERNAME. I'm attempting to pass this into a profile provider (which expects just a single backslash) and am getting nothing. I've attempted to do string.Replace() as well as RegEx.Replace() and can't seem to get rid of

Django legacy database encoding

蓝咒 提交于 2019-12-25 06:55:37
问题 I'm sure this question is not specific to django, but since I couldn't find any solution for my problem in other questions about python and encodings, I'm going to ask this. I need to add new features to existing website which is written in PHP using MySQL as backend. I inspected the database and created models for tables I am going to use. However, there is a problem with the existing data- half of it is in russian, and (at least it seems to me) it's in utf-8 encoding. When I show that data

UnicodeDecodeError: 'charmap' codec can't encode character X at position Y: character maps to undefined

主宰稳场 提交于 2019-12-25 06:43:36
问题 To CLARIFY: this question is not a duplicate of this one, I have already tried all the hints there and didn't get the answer. I have a txt file with unicode data in, and am want to open the file as an string. I tried a=open('myfile.txt', 'r', encoding='utf-8') print a.read() but there is an error saying: UnicodeDecodeError: 'charmap' codec can't encode character '\ufeff' at position Y: character maps to undefined Now my question is, I don't care about my UTF-8 characters at all, is there

UnicodeDecodeError: 'charmap' codec can't encode character X at position Y: character maps to undefined

僤鯓⒐⒋嵵緔 提交于 2019-12-25 06:42:35
问题 To CLARIFY: this question is not a duplicate of this one, I have already tried all the hints there and didn't get the answer. I have a txt file with unicode data in, and am want to open the file as an string. I tried a=open('myfile.txt', 'r', encoding='utf-8') print a.read() but there is an error saying: UnicodeDecodeError: 'charmap' codec can't encode character '\ufeff' at position Y: character maps to undefined Now my question is, I don't care about my UTF-8 characters at all, is there

Pentaho don't Generete PDF in UTF-8 encoding

萝らか妹 提交于 2019-12-25 06:38:16
问题 I have a problem related with PDF exportation in Pentaho BI plattform. I'm not able to produce a correct PDF file encoded in UTF-8 and which contains Spanish characters. That procedure neither works properly in local Report Designer nor in BI server. Special characters like 'ñ' or 'ç' are skipped in the PDF file. Generation in other formats works just fine (HTML, Excel, etc.). I've been struggling with that issue for few days being unable to find any solution and would be grateful for any

xml encoding and jquery parsing

雨燕双飞 提交于 2019-12-25 06:37:30
问题 Im having some trouble reading xml files using jquery that containts swedish chars (åäö) in my xml. It doesnt matter if i use <?xml version="1.0" encoding="UTF-8" ?> or <?xml version="1.0" encoding="ISO-8859-1"?> i will still get a parseerror in jquery. However, if i open the files in notepad++ and save with "utf-8 without BOM" it will work. But this is not an option, since i cant assume that all teh users will do that. How do i solve this? Thanks! 回答1: What is the parse-error you are

How to stop asp.net encoding characters before outputing to html?

浪尽此生 提交于 2019-12-25 06:26:36
问题 I have a function that generates a javascript code for me. <img src="abc.png" alt="hello" onclick="<%: getOnCilckJS(arg) %>" /> c# code protected String getOnCilckJS(int arg) { if (arg==1) { return "alert('hello world');"; } else { return "alert('hello universe');"; } } all works fine apart from when the page is loaded asp.net converts single quotations ' to the encoded html string ( ' ) How can I avoid this and make ' appear in the html? 回答1: Your code working to me : But just change <%: to

Bouncy Castle example for encoding CDR

邮差的信 提交于 2019-12-25 05:20:07
问题 I am trying to encode PGWRecord CDR using ASN.1 notation, starting on page 89 in this 3GPP TS Document I've been looking for awhile for examples how I can do this, but to no avail. Are there any examples that can show me how to do this using Bouncy Castle ? Or is there a better alternative than Bouncy Castle to encode this CDR? Step by step instructions on how I can do this would be very nice! Any help would be very appreciated. Thanks all! 回答1: Try to look at BinaryNotes. You have ASN.1