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

� cause C2001 and C1075 errors in VisualStudio 2022 #3598

Closed
qliang88 opened this issue Aug 18, 2023 · 7 comments
Closed

� cause C2001 and C1075 errors in VisualStudio 2022 #3598

qliang88 opened this issue Aug 18, 2023 · 7 comments

Comments

@qliang88
Copy link

https://github.com/fmtlib/fmt/blob/6c845f57e5db589208ff0c2808238587cafafa82/include/fmt/format.h#L1456C12-L1456C40

logs:
[build] .../fmt/format.h(1456,34): error C2001: newline in constant
[build] .../fmt/format.h(1456,33): fatal error C1075: '{': no matching token found

@vitaut
Copy link
Contributor

vitaut commented Aug 19, 2023

There is no newline there, most likely you are using some legacy encoding. Make sure to compile with /utf-8.

@vitaut vitaut closed this as completed Aug 19, 2023
@vitaut vitaut added the invalid label Aug 19, 2023
@YuHuanTin
Copy link
Contributor

There is no newline there, mostly likely you are using some legacy encoding. Make sure to compile with /utf-8.

I think this is a little bit wrong, because most msvc never specify utf-8 encoding by default, I may need to specify the whole project to utf-8 encoding because of one character, and he will affect the standard output (utf8 can be output normally but other encodings can not be displayed), and I have already encountered this problem, except for specifying \xstyle characters I can not think of a better way to increase the compatibility of the

@vitaut
Copy link
Contributor

vitaut commented Aug 19, 2023

What encoding do you use? BTW it looks like your comment was truncated.

@YuHuanTin
Copy link
Contributor

I think this is a little bit wrong, because most msvc never specify utf-8 encoding by default, I may need to specify the whole project to utf-8 encoding because of one character, and he will affect the standard output (utf8 can be output normally but other encodings can not be displayed), and I have already encountered this problem, except for specifying \xstyle characters I can not think of a better way to increase the compatibility of the

I'm using GBK encoding for the whole project now.
Maybe it's a translation problem, I retranslated it back and it seems to be fine.

@vitaut
Copy link
Contributor

vitaut commented Aug 19, 2023

@qliang88, could you confirm that #3599 fixes those MSVC errors?

@qliang88
Copy link
Author

qliang88 commented Aug 19, 2023

yes, no more errors after replaced by 0xFFFD.

@vitaut vitaut removed the invalid label Aug 19, 2023
vitaut pushed a commit that referenced this issue Aug 19, 2023
@vitaut
Copy link
Contributor

vitaut commented Aug 19, 2023

Merged the "fix" but please note that using legacy encodings is not recommended.

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

No branches or pull requests

3 participants