tfussell / xlnt

:bar_chart: Cross-platform user-friendly xlsx library for C++11+
Other
1.49k stars 418 forks source link

Problem for Visual Studio 2019 #460

Closed playgithub closed 3 years ago

playgithub commented 4 years ago

The files below should be encodeding in "UTF8 with BOM":

wanzhiyu commented 4 years ago

Right! These 2 files should be encodeding in "UTF8 with BOM". Or this project can not be compiled! @tfussell I was not able to generate .dll/.lib at first. Then I changed these 2 files's encoding to "UTF8 with BOM" and it works. However, I don't know why.😄

sphawk commented 3 years ago

@tfussell @playgithub @wanzhiyu visual studio cannot recognize these files utf-8 encoded.

if your windows system locale is not english, build will fail. (utf-8 character will break. you can see detail description in this link https://docs.unrealengine.com/en-US/ProgrammingAndScripting/ProgrammingWithCPP/UnrealArchitecture/StringHandling/CharacterEncoding/index.html "Notes about C++ Source Code Specific to East Asian Encodings" section)

521 is same problem.

solution:

  1. change file type to utf-8 with BOM
  2. use /utf-8 command when build using msvc. (this command introduced since visual studio 2015) visual studio recognize source file encoding as utf-8 you can add this on CMakeLists.txt when using MSVC, or use cmake command line like below. example) cmake -E env CXXFLAGS="/utf-8" cmake -G "Visual Studio 16 2019" -A x64 .. cmake -E env CXXFLAGS="/utf-8" cmake -G "Visual Studio 15 2017 Win64" ..
playgithub commented 3 years ago

So a fix for Windows in CMakeLists.txt is fine.