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

Incompatible character encoding error #377

Closed
avdv opened this issue Aug 3, 2020 · 4 comments · Fixed by #408
Closed

Incompatible character encoding error #377

avdv opened this issue Aug 3, 2020 · 4 comments · Fixed by #408
Labels

Comments

@avdv
Copy link
Collaborator

avdv commented Aug 3, 2020

[...]/colorls/core.rb:86:in `join': incompatible character encodings: UTF-8 and ASCII-8BIT (Encoding::CompatibilityError)

I am not fluent in ruby I am more in shell script I understand the probleme is probably the «é» character in /home/luxcium/Téléchargements

Output:

/home/luxcium/Téléchargements
Traceback (most recent call last):
        12: from /home/luxcium/bin/colorls:23:in `<main>'
        11: from /home/luxcium/bin/colorls:23:in `load'
        10: from /home/luxcium/.gem/ruby/gems/colorls-1.4.1/exe/colorls:26:in `<top (required)>'
         9: from /home/luxcium/.gem/ruby/gems/colorls-1.4.1/lib/colorls/flags.rb:43:in `process'
         8: from /home/luxcium/.gem/ruby/gems/colorls-1.4.1/lib/colorls/flags.rb:43:in `each_with_index'
         7: from /home/luxcium/.gem/ruby/gems/colorls-1.4.1/lib/colorls/flags.rb:43:in `each'
         6: from /home/luxcium/.gem/ruby/gems/colorls-1.4.1/lib/colorls/flags.rb:48:in `block in process'
         5: from /home/luxcium/.gem/ruby/gems/colorls-1.4.1/lib/colorls/flags.rb:48:in `new'
         4: from /home/luxcium/.gem/ruby/gems/colorls-1.4.1/lib/colorls/core.rb:29:in `initialize'
         3: from /home/luxcium/.gem/ruby/gems/colorls-1.4.1/lib/colorls/core.rb:86:in `init_contents'
         2: from /home/luxcium/.gem/ruby/gems/colorls-1.4.1/lib/colorls/core.rb:86:in `map!'
         1: from /home/luxcium/.gem/ruby/gems/colorls-1.4.1/lib/colorls/core.rb:86:in `block in init_contents'
/home/luxcium/.gem/ruby/gems/colorls-1.4.1/lib/colorls/core.rb:86:in `join': incompatible character encodings: UTF-8 and ASCII-8BIT (Encoding::CompatibilityError)
/home/luxcium/Téléchargements
 

My shell function in ZSH:

    function ld() {
        (
            local mypath="${@:-$(pwd)}"
            echo ''
            builtin cd "${mypath}"
            pw
            colorls -lA --sd -d "${mypath}"
            pw
            echo "${mypath}"
        )
    }

My locale:

locale      
LANG=fr_CA.UTF-8
LC_CTYPE="fr_CA.UTF-8"
LC_NUMERIC=fr_CA.UTF-8
LC_TIME=fr_FR.UTF-8
LC_COLLATE=fr_CA.UTF-8
LC_MONETARY=fr_CA.UTF-8
LC_MESSAGES="fr_CA.UTF-8"
LC_PAPER="fr_CA.UTF-8"
LC_NAME="fr_CA.UTF-8"
LC_ADDRESS="fr_CA.UTF-8"
LC_TELEPHONE="fr_CA.UTF-8"
LC_MEASUREMENT=fr_CA.UTF-8
LC_IDENTIFICATION="fr_CA.UTF-8"
LC_ALL=

Originally posted by @Luxcium in #242 (comment)

@avdv avdv changed the title *I probably should open my own issue but I will drop this here like if living on the edge is no big deal ...* Incompatible character encoding error Aug 3, 2020
@Luxcium
Copy link

Luxcium commented Sep 19, 2020

Ho ok I guess this is what "opening my own issue would have looked like" I don't have the problem anymore but I don't remember what I did so let me get more information about my issue...

I use this ld command each and every day it's even part of my cd command

@simonbcn
Copy link

Same problem.

$ locale
LANG=es_ES.UTF-8
LC_CTYPE="es_ES.UTF-8"
LC_NUMERIC="es_ES.UTF-8"
LC_TIME="es_ES.UTF-8"
LC_COLLATE="es_ES.UTF-8"
LC_MONETARY="es_ES.UTF-8"
LC_MESSAGES="es_ES.UTF-8"
LC_PAPER="es_ES.UTF-8"
LC_NAME="es_ES.UTF-8"
LC_ADDRESS="es_ES.UTF-8"
LC_TELEPHONE="es_ES.UTF-8"
LC_MEASUREMENT="es_ES.UTF-8"
LC_IDENTIFICATION="es_ES.UTF-8"
LC_ALL=

$ ls Imágenes
Traceback (most recent call last):
12: from /usr/bin/colorls:23:in `<main>'
11: from /usr/bin/colorls:23:in `load'
10: from /usr/lib/ruby/gems/2.7.0/gems/colorls-1.4.2/exe/colorls:26:in `<top (required)>'
9: from /usr/lib/ruby/gems/2.7.0/gems/colorls-1.4.2/lib/colorls/flags.rb:43:in `process'
8: from /usr/lib/ruby/gems/2.7.0/gems/colorls-1.4.2/lib/colorls/flags.rb:43:in `each_with_index'
7: from /usr/lib/ruby/gems/2.7.0/gems/colorls-1.4.2/lib/colorls/flags.rb:43:in `each'
6: from /usr/lib/ruby/gems/2.7.0/gems/colorls-1.4.2/lib/colorls/flags.rb:48:in `block in process'
5: from /usr/lib/ruby/gems/2.7.0/gems/colorls-1.4.2/lib/colorls/flags.rb:48:in `new'
4: from /usr/lib/ruby/gems/2.7.0/gems/colorls-1.4.2/lib/colorls/core.rb:29:in `initialize'
3: from /usr/lib/ruby/gems/2.7.0/gems/colorls-1.4.2/lib/colorls/core.rb:86:in `init_contents'
2: from /usr/lib/ruby/gems/2.7.0/gems/colorls-1.4.2/lib/colorls/core.rb:86:in `map!'
1: from /usr/lib/ruby/gems/2.7.0/gems/colorls-1.4.2/lib/colorls/core.rb:86:in `block in init_contents'
/usr/lib/ruby/gems/2.7.0/gems/colorls-1.4.2/lib/colorls/core.rb:86:in `join': incompatible character encodings: UTF-8 and ASCII-8BIT (Encoding::CompatibilityError)

@avdv
Copy link
Collaborator Author

avdv commented Oct 25, 2020

I already tried to reproduce this, but I could not. Is Imágenes a directory? What's the contents of it?

Note that I am AFC until next weekend...

@simonbcn
Copy link

simonbcn commented Oct 25, 2020

I can reproduce this with this folder structure:

$ exa -T Imágenes 
Imágenes
└── Cámara

avdv added a commit to avdv/colorls that referenced this issue Oct 31, 2020
@avdv avdv closed this as completed in #408 Oct 31, 2020
@avdv avdv added the bug label Nov 2, 2020
@avdv avdv mentioned this issue Mar 21, 2022
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants