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

Windows: Coala replaces some special caracters to unkown character #1238

Closed
tims0 opened this issue Jan 23, 2016 · 20 comments
Closed

Windows: Coala replaces some special caracters to unkown character #1238

tims0 opened this issue Jan 23, 2016 · 20 comments

Comments

@tims0
Copy link

tims0 commented Jan 23, 2016

When I run coala, it replaces some special characters like this:
coala1

When I want to start it a second time, I get these error messages, because it can't handle with the ?-Character:
coala2

@Makman2
Copy link
Member

Makman2 commented Jan 23, 2016

Seems to be an internal encoding issue somewhere. cmd uses a special encoding format (something with cp and a number) that is not really compatible to unicode that would explain this more or less^^

If you need to work with coala, try to use Powershell, I believe it uses unicode as default^^

I'll investigate this, but I have not that much time now so this could take a while^^

@sils
Copy link
Member

sils commented Jan 23, 2016

This is not a usability issue, it's a bug in coala. We shouldn't destroy his data like this. @Makman2 are we even sure this doesn't happen on linux?

Scheduling importance to high since this is connected to actual data loss.

@TimSo94 are you free to share the original file where this occurred with us?

@sils sils added this to the 0.4 alpha milestone Jan 23, 2016
@tims0
Copy link
Author

tims0 commented Jan 23, 2016

Yes, it happend in 2 files.
In the functions.py in line 75 and line 78 and in the models.py in line 108 and 109.

pys.zip

@sils
Copy link
Member

sils commented Jan 23, 2016

@TimSo94 we'll try to look into this soon. I hope we can get to fix this till next week.

@Makman2
Copy link
Member

Makman2 commented Jan 23, 2016

@TimSo94 could you also provide the .coafile? First reproduction on fedora 23 didn't yield an error, my assumed coafile was:

[Default]
bears = PEP8Bear
files = *.py

@sils
Copy link
Member

sils commented Jan 24, 2016

Mischa: you could just introduce an error and see if this occurs for now.
On 24 Jan 2016 00:51, "Mischa Krüger" notifications@github.com wrote:

@TimSo94 https://github.com/TimSo94 could you also provide the .coafile?
First reproduction on fedora 23 didn't yield an error, my assumed coafile
was:

[Default]
bears = PEP8Bear


Reply to this email directly or view it on GitHub
#1238 (comment)
.

@Makman2
Copy link
Member

Makman2 commented Jan 24, 2016

Introducing an error (in this case trailing whitespaces) did nothing.
(okay on fedora it marked the completely file as deleted and added, but I assume this is because of CRLF file endings that get completely rewritten when a patch is applied due to pythons universal-newlines conversion)

@Makman2
Copy link
Member

Makman2 commented Jan 24, 2016

Currently I have problems reproducing this on windows since coala doesn't take up the files there...

@Makman2
Copy link
Member

Makman2 commented Jan 24, 2016

Confirmed on Windows! Since this error only happened after apply, I believe @TimSo94 you have a setting like default_actions = PEP8Bear: AutoApplyAction so coala automatically fixes errors, that's why it replaces directly with these weird signs. After that it can't read them again.

@Makman2
Copy link
Member

Makman2 commented Jan 24, 2016

Also this doesn't come from the PEP8Bear, the according diff only showed me the error I introduced^^
Looks like the write-back is responsible for this...

@tims0
Copy link
Author

tims0 commented Jan 24, 2016

I only have the "Standard" Settings, here:
[Default]
bears = PEP8Bear
files = */.py

@sils
Copy link
Member

sils commented Jan 24, 2016

@Makman2 he applied it manually which does the same thing I guess, makes no difference

@sils
Copy link
Member

sils commented Feb 16, 2016

@AbdealiJK can you look into this one? We've had another occurrence too:

One thing I noticed is that all the UTF-8 characters have been replaced in our JSON files -- I'd like for them to stay as-is.

duckduckgo/zeroclickinfo-goodies#2289 (comment)

@sils
Copy link
Member

sils commented Feb 16, 2016

That one is rather #1527 .

@AbdealiLoKo
Copy link
Contributor

I do not have a windows machine to test - and hence it'd be difficult for me to do this

@AbdealiLoKo AbdealiLoKo removed their assignment Feb 16, 2016
@sils
Copy link
Member

sils commented Feb 18, 2016

maybe this can be solved with #1541 (comment) , @AbdealiJK can you try reproducing this and solving it?

@AbdealiLoKo
Copy link
Contributor

I am able to reproduce the. I opened the files in a hex editor and noticed 4 chars were removed when coala wrote back to it.

The symbol ° is B0 in the file after coala ran on it.
The same thing in the one before coala ran on it is @#° - 40 23 C2 B0

ALSO - This happens in git bash too. (Im not sure if it's windows specific anymore)

@AbdealiLoKo
Copy link
Contributor

Changing the writing of the file to with open(filename, mode='w', encoding='utf-8') as file: in coalib.results.result_actions.ApplyPatchAction (line 50) fixes this

@sils sils assigned sils and unassigned Makman2 Feb 18, 2016
@rultor rultor closed this as completed in b54ec7f Feb 18, 2016
@Makman2
Copy link
Member

Makman2 commented Feb 18, 2016

@TimSo94 is the bug solved for you?

@tims0
Copy link
Author

tims0 commented Feb 19, 2016

Yes, now it works fine. Thanks! :)

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

No branches or pull requests

4 participants