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

gbc does not handle UTF-8 characters in attribute values when generating C++ (and C#) #1113

Open
codeandroid opened this issue Jun 15, 2021 · 0 comments
Labels

Comments

@codeandroid
Copy link
Contributor

gbc successfully parses UTF-8 encoded bond files with attribute values like this one:

namespace demo

struct Thing
{
     [DisplayName("∑")]
     0: int32 sum;
}

It generates the UTF-8 encoded JSON schema file without issues:

(...)
{
    "attrName": [
        "DisplayName"
    ],
    "attrValue": "∑"
}

Unfortunately, gbc fails when generating C++ (or C#) code with an error:

gbc.exe: ...\demo_types.cpp: commitAndReleaseBuffer: invalid argument (invalid character)

I tried Haskell string escaping but to no avail.

I also found #687 but that issue relates to C++ identifiers.

I see no immediate reason (and could not find one by searching through the repo) why UTF-8 encoded attribute values could not be properly generated in C++ code. GCC and Clang should pose no problem. For MSVC this might require setting the byte-order-mark in the generated source file though I'm not 100% sure about that (see Docs ).

@chwarr chwarr added the bug label Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants