encoding

FileUpload filename encoding

对着背影说爱祢 提交于 2020-01-13 20:28:52
问题 It's been quite a while since I'm banging my head against this: multipart/mixed content. @RequestPart(name="view") CoolView, @RequestPart(name="files") Part [] files Also using spring's (it does not matter because CommonsMultipartResolver fails too) : StandardServletMultipartResolver Now the thing is that when uploading files that have some names outside US_ASCII characters, the server is converting them into something weird. And by weird I mean it converts them to ISO_8859_1, and I think I

UTF8 Encoding changes data Format

最后都变了- 提交于 2020-01-13 20:19:40
问题 I'm trying to get the output of a command in PowerShell and encode it and then decode it again to receive the results of the said command as shown. $enc = [system.Text.Encoding]::UTF8 $bytes = $enc.GetBytes((Invoke-Expression "net users")) $enc.GetString($bytes) However, the result comes out malformed as opposed to the original net users command. I've tried changing the encodings to ASCII and Unicode and still the result is malformed. Any ideas on how to maintain the formatting? 回答1: The

Read Japanese Character using Scanner

牧云@^-^@ 提交于 2020-01-13 19:26:34
问题 Possible duplicate: How can I read Chinese characters correctly using Scanner in Java? My input file name may have japanese characters and I am trying to read the file name using Scanner. Scanner sc = new Scanner(System.in,"utf-8"); System.out.println("Encoding is :" + Charset.defaultCharset()); System.out.println("Enter the path:"); inputFilePath = sc.nextLine(); and if my input is for eg - 漢字 When I print the file name my output is Encoding is :UTF-8 Input File Path:漢字 I also tried,

R RMySQL query deforms japanese characters

一个人想着一个人 提交于 2020-01-13 19:13:36
问题 I am using RMySQL to connect to an aws MySQL server. It works, except character values are deformed. This question has been asked before but the fixes don't seem to work for me. Here's what I'm doing: Make sure no connections are open: dbListConnections(MySQL()) list() Make sure my connection is set to use UTF-8: dbGetQuery(credentials, "show variables like 'character_set%'") Variable_name Value 1 character_set_client utf8 2 character_set_connection utf8 3 character_set_database utf8 4

How can I convert a UUID to base64?

允我心安 提交于 2020-01-13 12:14:07
问题 I want to take type UUID and output it in a Base64 encoded format, however given the input methods on Base64 and outputs on UUID how to accomplish this doesn't seem obvious. update though not an explicit requirement for my use case, it would be nice to know if the method used uses the raw UUID (the 128 bits that a UUID actually is) of the UUID, as the standard hex encoding does. 回答1: First, convert your UUID to a byte buffer for consumption by a Base64 encoder: ByteBuffer uuidBytes =

Javascript -> Download CSV file encoded in ISO-8859-1 / Latin1 / Windows-1252

☆樱花仙子☆ 提交于 2020-01-13 12:08:15
问题 I have hacked together a small tool to extract shipping data from Amazon CSV order data. it works so far. here is a simple version as JS Bin: http://output.jsbin.com/jarako For printing stamps/shipping labels, I need a file for uploading to Deutsche Post and to other parcel services. I used a small function saveTextAsFile which i found on stackoverflow. Everything good so far. No wrong displayed special characters (äöüß...) in the output textarea or downloaded files. All these german post /

Javascript -> Download CSV file encoded in ISO-8859-1 / Latin1 / Windows-1252

这一生的挚爱 提交于 2020-01-13 12:08:14
问题 I have hacked together a small tool to extract shipping data from Amazon CSV order data. it works so far. here is a simple version as JS Bin: http://output.jsbin.com/jarako For printing stamps/shipping labels, I need a file for uploading to Deutsche Post and to other parcel services. I used a small function saveTextAsFile which i found on stackoverflow. Everything good so far. No wrong displayed special characters (äöüß...) in the output textarea or downloaded files. All these german post /

How to change the preferred encoding in Sublime Text 3 for MacOS

杀马特。学长 韩版系。学妹 提交于 2020-01-13 11:43:32
问题 I want to change the preferred encoding from US-ASCII to UTF-8 in Sublime Text 3 on Yosemite. The preferred encoding in the bash is set to UTF-8 so when python is run in the terminal: import locale print(locale.getpreferredencoding()) the output is: UTF-8 When the same code is run in Sublime Text, the output is US-ASCII . Setting in the build system for Python 3: "encoding": "UTF-8" or "env": {"PYTHONIOENCODING": "utf-8} has not helped. How can the setting be changed permanently so that I don

Why do I get a ASCII encoding error with Unicode data in Python 2.4 but not in 2.7?

纵饮孤独 提交于 2020-01-13 11:25:50
问题 I have a program that, when run in Python 2.7, produces proper Unicode output to the standard output. When run in Python 2.4, I get UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-4: ordinal not in range(128) . What changed between version 2.4 and 2.7 that this works now? 回答1: Although I could not find any mention of it elswhere, it appears that Python 2.7 is automatically converting text to the terminal encoding, instead of throwing an error as expected. Python 2.7: >

powershell character encoding from System.Net.WebClient

匆匆过客 提交于 2020-01-13 10:22:13
问题 I am running the following command: ([xml](new-object net.webclient).DownloadString( "http://blogs.msdn.com/powershell/rss.aspx" )).rss.channel.item | format-table title,link The output for one of the RSS items contains this weird text: You Don’t Have to Be An Administrator to Run Remote PowerShell Commands So, the question is: Why the mix up in characters? What happened to the apostrophe? Why is the output rendered as Don’t when it should just render as Don't ? How would I get the