Dark Storm
Dark Storm

Reputation: 329

Unexpected character '�' while building the project image with Docker

 


Unexpected character error while building the project in a docker container


I'm creating an image of an ASP.NET CORE application that has dependency to a multiple projects not only inside the same solution but also use another class libraries in another solutions I copied the project's file, and the .sln files,it restore all the projects, however, when I attempt to build the project in a docker container an Error is encountered that prints the following message:


The Error that is Occurring, is "CS 1056"


error CS1056: Unexpected character '�'

Hint : the same error occur when i open the project using VS code

That makes sense, because there is 'obviously' a character that VS code can't decode.

After troubleshooting for a while, I found that the character causing the issue is ä (and German letter in general ü ä ß ...).




what is the way to build the project inside a docker container and avoid that error ?

I only want to build the project in a docker container correctly by the way if I build the project using powershell in Host windows OS it builds correctly with no problem .

Thanks

Upvotes: 1

Views: 1229

Answers (1)

AKUMA no ONI
AKUMA no ONI

Reputation: 11839

Whether you are in VS Code, or you are in docker the same simple solution applies. Also, it is important to note, a quick google search would have produced ample enough information to have solved this issue.

So this is Computer Science 101, its fundamental to all programming languages, and systems. You have to configure your project to use the same encoding as your system, which in this case is Linux.

DOCKER = LINUX SHELL

POWERSHELL = Well, just Powershell.

Docker & Powershell, are both shells, but two totally different system-environments. You will need to configure Docker, and the SSH client your using to remotely work in docker to use the same encoding as your project.

You said you don't care about VS Code so I guess, your using a different SSH client?

In this case it is German characters causing the issue, and because your using a Microsoft tech-stack (i.e. C#, ASP.NET, etc...) its going to be a CP.

According to Microsoft

...CP1252 will cover both English (which obviously you need, and German alphabets (also included is French).

Upvotes: 2

Related Questions