Skip to content

Conversation

qgppl
Copy link
Contributor

@qgppl qgppl commented Jan 1, 2024

Proposed changes

Include default system code page in default encodings list.

Before

On Windows 10 PL, the default encoding set in GitExtensions contain the following: UTF-8, US-ASCII, Unicode, Central European (DOS).

"Central European DOS", cp852, is the one returned by GetEncoding(CultureInfo.CurrentCulture.TextInfo.OEMCodePage).

Under Windows however, the default 8-bit encoding of files in PL locale is "Central European (Windows)" (ansi / windows-1250). This encoding is returned by GetEncoding(0). So, in order to use it (in diff viewer, for example), one must find and change the git encoding setting.

After

Result of GetEncoding(0) is also added to populate the default encoding list.

Test methodology

  • Manual test run without configuration file
  • Code is under try/catch so possible errors will be silently ignored.
  • If GetEncoding for OEMCodePage and 0 return the same encoding, they will be deduplicated by map.

Test environment(s)

  • Windows 10 PL

Merge strategy

I agree that the maintainer squash merge this PR (if the commit message is clear).


✒️ I contribute this code under The Developer Certificate of Origin.

@ghost ghost assigned qgppl Jan 1, 2024
@vbjay
Copy link
Contributor

vbjay commented Jan 1, 2024

Reading from system level config and not global and lower would also prevent us from missing the system level config where this encoding is usually configured.

@gerhardol
Copy link
Member

Probably fine.
It is possible to configure this too:
image

If set, this patch will not be used

Copy link
Member

@RussKie RussKie left a comment

Choose a reason for hiding this comment

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

👍 modulo the other comments

@qgppl qgppl force-pushed the default-encoding branch from d0e04aa to 80f1650 Compare January 2, 2024 06:15
Copy link
Contributor

@vbjay vbjay left a comment

Choose a reason for hiding this comment

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

Potential duplicate encodings being added to list.

@RussKie RussKie merged commit 7e34b01 into gitextensions:master Mar 3, 2024
@ghost ghost added this to the vNext milestone Mar 3, 2024
@RussKie
Copy link
Member

RussKie commented Mar 3, 2024

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants