Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix encoding error for non UTF-8 locale #353

Merged
merged 1 commit into from
Apr 16, 2020
Merged

Conversation

avdv
Copy link
Collaborator

@avdv avdv commented Apr 15, 2020

Description

If the user misconfigures the locale and thus the wrong encoding is used to interpret file names, we might run into an encoding problem later.

Also, if the encoding is not capable of handling unicode symbols, we should not display icons and replace undefined characters with a replacement character.

@avdv avdv force-pushed the fix-352 branch 2 times, most recently from 71d0091 to 56d3a1f Compare April 15, 2020 21:16
@codecov-io
Copy link

codecov-io commented Apr 15, 2020

Codecov Report

Merging #353 into master will decrease coverage by 0.76%.
The diff coverage is 60.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #353      +/-   ##
==========================================
- Coverage   88.75%   87.99%   -0.77%     
==========================================
  Files           8        8              
  Lines         498      508      +10     
==========================================
+ Hits          442      447       +5     
- Misses         56       61       +5     
Impacted Files Coverage Δ
lib/colorls/git.rb 70.00% <0.00%> (-7.78%) ⬇️
lib/colorls/core.rb 88.63% <70.00%> (-0.77%) ⬇️
lib/colorls/fileinfo.rb 80.00% <100.00%> (+2.22%) ⬆️
lib/colorls/yaml.rb 85.71% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5640a6e...a06b41c. Read the comment docs.

On Unix systems the encoding of file names is specified by the user via the
locale settings.

In order to avoid encoding problems simply read file names in ASCII 8 bit
encoding and try to convert to the external encoding while replacing undefined
characters.

Also, does not show an icon if the external encoding does not support it and
shows a `=` instead of a check mark for git status.

Fixes athityakumar#352.
@avdv avdv changed the title Failing test Fix encoding error for non UTF-8 locale Apr 16, 2020
@avdv avdv marked this pull request as ready for review April 16, 2020 20:01
@avdv avdv merged commit 1234d82 into athityakumar:master Apr 16, 2020
@avdv avdv deleted the fix-352 branch April 16, 2020 20:10
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.

2 participants