file-encodings

Java Charset problem on linux

巧了我就是萌 提交于 2021-02-06 15:53:14
问题 problem: I have a string containing special characters which i convert to bytes and vice versa..the conversion works properly on windows but on linux the special character is not converted properly.the default charset on linux is UTF-8 as seen with Charset.defaultCharset.getdisplayName() however if i run on linux with option -Dfile.encoding=ISO-8859-1 it works properly.. how to make it work using the UTF-8 default charset and not setting the -D option in unix environment. edit: i use jdk1.6

Converting Mac Roman character to equivalent UTF-8

和自甴很熟 提交于 2020-01-30 04:51:33
问题 I have been given some HTML files that use the Mac OS Roman file encoding. The files have French text, but in an editor many of the diacritical chars look strange (i.e. non French) Si cette option est sÈlectionnÈe, <removed> tentera de communiquer avec votre tÈlescope seulement ‡ líaide díun ... The capital E with accent does display properly in the browser as é as do the other strange characters. I also have some UTF-8 French files that look normal in an editor (é looks like é). What I'd

PowerShell out-file: prevent encoding changes

我们两清 提交于 2020-01-09 13:09:30
问题 I'm currently working on some search and replace operation that I'm trying to automate using powershell. Unfortunately I recognized yesterday that we've different file encodings in our codebase (UTF8 and ASCII). Because we're doing these search and replace operations in a different branch I can't change the file encodings at this stage. If I'm running the following lines it changes all files to UCS-2 Little Eindian even though my default powershell encoding is set to iso-8859-1 (Western

Android Studio “File was loaded in the wrong encoding:'UTF-8'” and “Java file does not declare any class” out of nowhere

↘锁芯ラ 提交于 2019-12-25 03:14:03
问题 Please note that I've read "File was loaded in the wrong encoding:'UTF-8' in IntelliJ IDEA" this, and everything else related to this issue that I'm having which is going to make me rewrite everything that I did in my project in past 2 days. Now, the only reason I'm asking this question, is because if someone else faces this problem in future, it'd possibly have a solution by then? So here is the problem : I was working on my app which is already present on Play Store, I made all the changes

PerlIO in Windows PowerShell and CMD.exe

蓝咒 提交于 2019-12-24 09:00:46
问题 Apparently, a Perl script I have results in two different output files depending on if I run it under Windows PowerShell, or cmd.exe. The script can be found at the bottom of this question. The file handle is opened with IO::File , I believe that PerlIO is doing some screwy stuff. It seems as if under cmd.exe the encoding chosen is much more compact encoding (4.09 KB), as compared to PowerShell which generates a file nearly twice the size (8.19 KB). This script takes a shell script and

Division symbol in text file in raw folder

*爱你&永不变心* 提交于 2019-12-20 03:41:36
问题 I have ÷ in .txt file in my android. When this division symbol is shown on android device, I see "�" To make it worse, my laptop doesn't have division sign on keyboard. I used the above sign from wikipedia. Any guess how can I resolve this. 回答1: You should use the Unicode value for any symbols such as the division symbol you have here. Try the Unicode U00F7. When using it within a String format like "\u00F7" . 回答2: The problem is most likely a font issue, or possibly a unicode encoding issue.

How can I be sure of the file encoding?

[亡魂溺海] 提交于 2019-12-17 08:16:06
问题 I have a PHP file that I created with VIM, but I'm not sure which is its encoding. When I use the terminal and check the encoding with the command file -bi foo (My operating system is Ubuntu 11.04) it gives me the next result: text/html; charset=us-ascii But, when I open the file with gedit it says its encoding is UTF-8. Which one is correct? I want the file to be encoded in UTF-8. My guess is that there's no BOM in the file and that the command file -bi reads the file and doesn't find any

How to expand file content with powershell

大兔子大兔子 提交于 2019-12-08 20:43:29
I want to do this : $content = get-content "test.html" $template = get-content "template.html" $template | out-file "out.html" where template.html contains <html> <head> </head> <body> $content </body> </html> and test.html contains: <h1>Test Expand</h1> <div>Hello</div> I get weird characters in first 2 characters of out.html : �� and content is not expanded. How to fix this ? mklement0 To complement Mathias R. Jessen's helpful answer with a solution that: is more efficient. ensures that the input files are read as UTF-8, even if they don't have a (pseudo-) BOM (byte-order mark) . avoids the

Powershell: Get default system encoding

梦想的初衷 提交于 2019-12-08 14:56:26
问题 The powershell cmdlet out-file has the switch -encoding witch you can set to default . This default value will use the encoding of the system's current ANSI code page. My question is: How can I get the name of this default encoding that out-file will use with powershell? 回答1: Take a look at [System.Text.Encoding]::Default , I believe it is used as "default". E.g. in my case: [System.Text.Encoding]::Default.EncodingName gets Cyrillic (Windows) 来源: https://stackoverflow.com/questions/5326304

Charset of Java source file and failing test

非 Y 不嫁゛ 提交于 2019-12-08 05:30:19
问题 First, I'd like to say that I've spent a lot of time searching for an explanation/solution. I've found hints of the problem, but no way to resolve my particular issue. Hence the post on a topic that seems to have been beaten to death in at least some cases. I have a Java test class that tests for proper encoding/decoding by a Mime utility. The strings used for testing are declared in the source file and we use assertEquals() to test equality after processing the input string. Here's an