2

I use Matlab on Windows and commit my changes on my work's GitLab.
All the accent characters within my files, such as é or à, do not display on the GitLab web interface (they just disappear).
For instance, Caractères non-affichés : à é è ô ö ...
gives Caractres non-affichs : ...

I tried changing git setting to "commit as is" but it didn't work.

Does anyone have some ideas or questions ?

Thanks.

EDIT : GitLab lets me use a web code editor for my files. The characters in it show up, but they are broken. : � �
If I change them manually, they then display properly in GitLab.

EDIT2 : I pushed files using git command and it worked properly.
Now Matlab displays the bad characters as broken. But when I write new lines and push, they display properly in both Matlab and gitLab.

Daemon Painter
  • 3,208
  • 3
  • 29
  • 44
Zekovski
  • 301
  • 1
  • 10
  • 1
    Hello and welcome to SO. Could you please provide a brief txt example to replicate the issue on our end? – Daemon Painter Nov 19 '20 at 09:46
  • Will this do ? `Caractères non-affichés : à é è ô ö ...` – Zekovski Nov 19 '20 at 09:54
  • 1
    yes, please [edit](https://stackoverflow.com/posts/64908950/edit) the question to add relevant details. Comments are overseen – Daemon Painter Nov 19 '20 at 09:58
  • 1
    this is committed as caracteres `non-affiches : a e e o o`? – Daemon Painter Nov 19 '20 at 09:59
  • No, it gives `Caractres non-affichs : ...` – Zekovski Nov 19 '20 at 10:00
  • I think the MATLAB git (or git in general, not sure) does only accept ASCII. Not in the files, but in the commands – Ander Biguri Nov 19 '20 at 10:21
  • no, I've committed files with accents many times. Besides, it would be a terrible versioning tool in such case. Matlab maybe is the cause. Can you try to commit the file without using matlab? And, is the file actually modified or is it just a display issue in GitLab? – Daemon Painter Nov 19 '20 at 10:59
  • I have pushed a txt with accents using command lines. It displays properly. So maybe it is the way Matlab encodes files. – Zekovski Nov 19 '20 at 11:09
  • So it gets wierder : I added changes using matlab and pushed them. And they display properly. Can the .txt or .m extension have something to do with it ? – Zekovski Nov 19 '20 at 11:13
  • If you use your own git client to check out the files containing diacritics that don't display correctly in GitLab, are the characters with diacritics still there? – Will Nov 19 '20 at 11:16
  • Just modified a .m file with Matlab. Commit and push via command lines made it look OK. – Zekovski Nov 19 '20 at 11:16
  • OK it works when I push with Matlab now. And the previously bad characters display has broken in Matlab. So I guess the file had a bad encoding the first time. And Using it with git command changed it ? – Zekovski Nov 19 '20 at 11:21
  • Please read [this](https://stackoverflow.com/questions/10623498/what-can-cause-git-to-mess-with-character-encoding), you'll find it relevant. I believe this to be an issue with char encoding in Matlab. The file extension has nothing to do with it. – Daemon Painter Nov 19 '20 at 11:28
  • also [relevant](https://gitlab.com/eidheim/Simple-Web-Server/-/issues/103) as well as any google-fu search on the subject "encoding GitLab issue" – Daemon Painter Nov 19 '20 at 11:31
  • 1
    Another possibility is that your file was saved with a valid ANSI encoding (my MATLAB installation apparently uses `windows-1252` [based on my machine's locale settings](https://stackoverflow.com/questions/4984532/unicode-characters-in-matlab-source-files), for example) for which there is an [open GitLab bug causing problems displaying characters with this encoding](https://gitlab.com/gitlab-org/gitlab/-/issues/34874). – Will Nov 19 '20 at 11:34
  • If I get it right, the accents were broken in the first place. I wonder what made this, and what can I do to avoid it in the future ? – Zekovski Nov 19 '20 at 11:39
  • You are right. I just checked with Notepad++ and it's encoded in AINSI. utf8 does not display properly. – Zekovski Nov 19 '20 at 11:41
  • I will test some things and if it works I'll post an answer and mark the subject as closed. – Zekovski Nov 19 '20 at 11:49

1 Answers1

2

My files were first encoded as ANSI. So Matlab could display everything right, but not GitLab. (See Will's link : https://gitlab.com/gitlab-org/gitlab/-/issues/34874)

I just had to open them all with Notepad++ to convert them to UTF8, commit and push. And now everything's shiny !

Thank you everyone for your help.

Zekovski
  • 301
  • 1
  • 10
  • You can accept your own answer if you're satisfied it's the solution to you question – Will Nov 19 '20 at 12:55
  • It says I have to wait for 2 days before accepting it. Otherwise I would have done it already. : / I'll come back later. Thanks. – Zekovski Nov 19 '20 at 13:13