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

parser can't handle utf-8 characters #701

Open
yvz5 opened this issue Oct 14, 2024 · 0 comments
Open

parser can't handle utf-8 characters #701

yvz5 opened this issue Oct 14, 2024 · 0 comments

Comments

@yvz5
Copy link

yvz5 commented Oct 14, 2024

hi all,

I am trying to parse a graphql schema string but get an error:

# Some german Letters: ÄÖÜ
enum UserType {
    USER
    ADMIN
}
"Syntax Error schema (2:6) Expected {, found Name \"UserType\"\n\n1: # Some german Letters: ÄÖÜ\n2: enum UserType {\n        ^\n3:     USER\n"

it looks like the parser can not handle UTF-8 characters. I wonder why ?

you can test it yourself with the following test:

func TestParsesUTF8(t *testing.T) {

	doc := `
                # Some german Letters: ÄÖÜ
		enum UserType {
			USER
			ADMIN
		}
	`
	astDoc, err := Parse(ParseParams{
		Source: doc,
		Options: ParseOptions{
			NoLocation: false,
			NoSource:   true,
		},
	})
	if err != nil {
		t.Fatalf("Parse failed: %v", err)
	}

	if astDoc == nil {
		t.Fatalf("unexpected nil document")
	}
}
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

Successfully merging a pull request may close this issue.

1 participant