utf-8

PHP - How to save text file with ANSI encoding?

丶灬走出姿态 提交于 2020-06-27 08:21:39
问题 I'm doing: file_put_contents("txt/myfile.txt", $fileContents); I have tried many ways to force my text file to be ANSI, like: $fileContents = mb_convert_encoding($fileContents , mb_detect_encoding($fileContents , mb_detect_order(), true), 'WINDOWS-1252'); I have also tried: $fileContents = iconv("ISO-8859-1", "WINDOWS-1252", $fileContents ); I need ANSI because the text file should look nice when I open it with the "type" command from MS-DOS (cmd.exe in Windows 7) If I open my current file I

Safe to use any utf-8 character in git commit messages?

一曲冷凌霜 提交于 2020-06-27 08:07:42
问题 I find it useful to use UTF8 characters such as ❌ (see here) in commit messages. refactor (NewService): Added better service & ❌ OldServiceA From what I can see, it seems fine. But I want to check if I'm opening myself up to any significant interoperability issues (CI tools, different OS's etc). Does anyone consider this safe/unsafe? 回答1: From https://git-scm.com/docs/git-commit: Commit log messages are typically encoded in UTF-8, but other extended ASCII encodings are also supported. This

Error in json.loads() for data that has base64 decoding applied

无人久伴 提交于 2020-06-27 04:27:11
问题 I am trying to use json.loads() in python I get the error: the JSON object must be str, not 'bytes' a = {'h': '123', 'w': '12345', 'data': "b'eyJod2lkIjpwomfcwpvepovnepovqrepniLLKJAMSNDMSNDMAWEFMOEDAad='"} a.update(json.loads(base64.b64decode(a['data']))) Here the 'data' portion of a was being loaded in as a json dump with b64encoding. 'data':base64.b64encode(json.dumps(test).encode()); where test = some string eg('epovqrepniLLKJAMSNDMSNDMAWEFMOEDAad=') I have tried using: a.update(json.loads

Error in json.loads() for data that has base64 decoding applied

末鹿安然 提交于 2020-06-27 04:27:00
问题 I am trying to use json.loads() in python I get the error: the JSON object must be str, not 'bytes' a = {'h': '123', 'w': '12345', 'data': "b'eyJod2lkIjpwomfcwpvepovnepovqrepniLLKJAMSNDMSNDMAWEFMOEDAad='"} a.update(json.loads(base64.b64decode(a['data']))) Here the 'data' portion of a was being loaded in as a json dump with b64encoding. 'data':base64.b64encode(json.dumps(test).encode()); where test = some string eg('epovqrepniLLKJAMSNDMSNDMAWEFMOEDAad=') I have tried using: a.update(json.loads

How to convert EBCDIC with chinese chars to UTF-8 format

我的梦境 提交于 2020-06-26 13:51:07
问题 I have a requirement to convert a file with EBCDIC encoding which is encoded using the IBM937 code page to UTF-8 format for loading the file into a multi-byte enabled DB2 database. I have tried unix recode and iconv. None of them has the ability to convert IBM 937 to UTF8. I'm looking for any utility (java, perl, unix ) in this world which can do that on a unix based system. Can someone help me here? SL 回答1: Take a look at ICU (International Components for Unicode): http://site.icu-project

Spanish Characters in HTML Page Title

风流意气都作罢 提交于 2020-06-25 09:05:23
问题 My HTML code for Page title looks like this <title>Telefonía</title> When i check it on browser the SPanish character is not displayed exactly like the above It shows page title as below I tried using & iacute; AND **&# 237; ** but it doesnt work in PAGE TITLE Here is my website url http://tinyurl.com/agdsqff i checked all the special codes but it doesnt work 回答1: Try writing í instead. These are HTML escape characters. Here you can find a whole list http://www.theukwebdesigncompany.com

Combining accent and character into one character in java 7

徘徊边缘 提交于 2020-06-23 08:09:48
问题 I am trying to write a java code that returns a single character combining both a character and an accent. The actual result of combining is a string and not one single character. The following is a simple method to illustrate what I am trying to do. Thank you private char convert (char c) { if (c == '\u0130') { return '\u0069 \u0307'; // If the return value is String I get i. } //I need small i double dot else return c; } 回答1: Normalizer can decompose/compose your character as you like:

UnicodeDecodeError when trying to read docx file

南笙酒味 提交于 2020-06-22 13:20:49
问题 Error occurs when opening docx file using python 3 When I tried to run: file=open("jinuj.docx","r",encoding="utf-8").read() below error occured 319 # decode input (taking the buffer into account) 320 data = self.buffer + input --> 321 (result, consumed) = self._buffer_decode(data, self.errors, final) 322 # keep undecoded input until the next call 323 self.buffer = data[consumed:] UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 11: invalid start byte 回答1: python-docx can

PostgreSQL: character with byte sequence 0xc2 0x81 in encoding “UTF8” has no equivalent in encoding “WIN1252”

不打扰是莪最后的温柔 提交于 2020-06-22 11:39:50
问题 Getting the below exception while executing SELECT query for a particular row on that table ERROR: character with byte sequence 0xc2 0x81 in encoding "UTF8" has no equivalent in encoding "WIN1252" One of the column in that row contains Japanese character which has been encoded with UTF-8 and inserted into it. Is there any fix for this issue? 回答1: You should know what encoding is used in your database. SHOW server_encoding; When you connect to your database you can specify what encoding should

Importing utf-8 encoded csv in meteor using Papa Parse

邮差的信 提交于 2020-06-18 18:19:32
问题 I am having trouble exporting some data from one meteor application (meteor application 1) as a CSV, then uploading that CSV file to a separate meteor application (meteor application 2) . Specifically, while the file is exported from meteor application 1 with utf-8 encoding, I do not know how to “tell” meteor application 2 that the csv encoded in utf-8 format. As a result, the data, as received by meteor application 2 gets corrupted with utf-8 jargon like “%u2019” etc I’m using the package