Escaping characters with grpc client

What I want to do

Query data with the gRPC Client and nestjs and escape special characters.

What I did

I got the client working and fetching data from the db is also possible. But when searching for strings with certain special characters, the query fails. Is there a list of special characters available which need to be escaped?

can you give examples?


Example query:

const name: string = 'test';
const query: string = `
    query queryStuff() {
      var(func: type(Person)) @filter(anyofterms(, ${name}) {
        ids as uid
      query(func: type(Person)) @filter(uid(ids)) {

If for example const name includes a " (double quote) the query fails. Is it correct to escape double quotes with a single backslash?

If so, are there other characters which need to be escaped and if so, how?

One more thing which i noticed: if a persons name is equal to - (a single hyphen, or some other single special characters as well), searching for them seems not possible?

Generally when searching with special characters like slash etc the search seems pretty unreliable or non predictable. For example when searching for anyofterms(, “N/A”) i would expect only persons with the name N/A. This doesn’t seem to be the case.

Quotes are part of the language itself(JS in that case). It should not be an issue. Also this is not escaping.

If you really need to escape something, you should use the JSON pattern of escaping.

It depends on the type of indexing. Which one are you using? in general all should accept hyphen. Weird. Also, you need at least 3 characters to start a search. As far as I remember.

Are you using Term indexing? it is based on terms, if you use N/A those aren’t terms.

Can you print out what comes out of here?

If you still can’t get out of this problem use this below