Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

lhDream
Copy link
Contributor

@lhDream lhDream commented Nov 26, 2022

Solve the problem that CJK characters cannot be packaged and installed packages and garbled characters. #202

@lhDream
Copy link
Contributor Author

lhDream commented Nov 26, 2022

https://stackoverflow.com/questions/51066207/utf-8-characters-not-displaying-correctly-in-inno-setup
The UTF-8 string output by java will not carry BOM

@fvarrui fvarrui changed the base branch from master to devel December 7, 2022 13:39
@fvarrui fvarrui added the feedback Waiting for feedback label Dec 7, 2022
Process process = command.execute();

BufferedReader output = new BufferedReader(new InputStreamReader(process.getInputStream()));
BufferedReader output = new BufferedReader(new InputStreamReader(process.getInputStream(), Charset.forName("GBK")));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is GBK for?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this won't present other problems with other language encodings?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure.
maybe so:

BufferedReader output = new BufferedReader(new InputStreamReader(process.getInputStream(), CharSetUtil.getCommandLineChartSet()));
public class CharSetUtil {

    public static Charset getCommandLineChartSet(){
        try{
            Process p = Runtime.getRuntime().exec("cmd /k chcp");
            BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
            String res = br.readLine();
            String code = find("\\d+",res);
            switch (code){
                case "936": return Charset.forName("GBK");
                case "65001": return Charset.forName("UTF-8");
            }
        }catch (Exception e){
        }
        return return Charset.defaultCharset();
    }

    private static String find(String pattern,String data){
        Pattern r = Pattern.compile(pattern);
        Matcher matcher = r.matcher(data);
        matcher.find();
        return matcher.group();
    }

}

https://learn.microsoft.com/en-us/windows/win32/intl/code-page-bitfields

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @fvarrui
Do you have any questions?

@lhDream lhDream requested a review from fvarrui December 23, 2022 07:03
@fvarrui fvarrui changed the base branch from devel to pr-271 January 5, 2023 10:50
@fvarrui fvarrui merged commit 2d25ac8 into javapackager:pr-271 Jan 5, 2023
@fvarrui
Copy link
Collaborator

fvarrui commented Jan 5, 2023

Hi @lhDream!
Thanks for your PR ... I'll give it a try asap.

@fvarrui
Copy link
Collaborator

fvarrui commented Jan 9, 2023

Please, take a look at this:

https://github.com/fvarrui/JavaPackager/blob/49528dc8a4a42e448f3a6797bdb70f52ad8b63a7/src/main/java/io/github/fvarrui/javapackager/utils/VelocityUtils.java#L65-L76

I reverted your changes in this part of the code, but keeping the possibility to render files with Velocity including the BOM ... We should only include the BOM in those files where it is essential, not in all files by default. Do you know which files really need it?

@lhDream
Copy link
Contributor Author

lhDream commented Jan 9, 2023

Hi @fvarrui

It is currently known that the iss.vtl file requires

@lhDream
Copy link
Contributor Author

lhDream commented Jan 10, 2023

Hi @fvarrui
Of course, but there is no such branch as pr-272,or what you want to say is pr-271

I tested with pr-271 branch no problem.

@fvarrui
Copy link
Collaborator

fvarrui commented Jan 10, 2023

Yes, sorry, I mean 271 🙄

@lhDream
Copy link
Contributor Author

lhDream commented Jan 10, 2023

@fvarrui
I tested with pr-271 branch no problem.

@fvarrui
Copy link
Collaborator

fvarrui commented Jan 12, 2023

Merged into devel, ready to be released in the next version

@commi
Copy link
Contributor

commi commented Feb 13, 2023

FYI: This change breaks with the non-unicode InnoSetup 5.x version... it cant read the iss file.

This IS version is old, but this could be added to the documentation. (use 6.x or 5.x Unicode)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feedback Waiting for feedback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.