Special Characters in values

If your predicate has special characters, then you should wrap it with angular brackets while asking for it in the query. E.g. < first:name > , how to do special characters in string values

1 Like

@MichelDiz do you have any ideas about this?

Inside predicates there’s no kind of “\scape\”. If the characters is rejected, certain that it is not supported. But if my answer does not satisfy, please elaborate a little more. And provide examples.

like _:bob “\?\myname”

Error : while lexing _:bob “?muname” .: Invalid escape character : ‘?’ in literal

That hipotesis would be something like:
_:bob <\?\my:name\> "Bob Dylan" .

But that approach does not exist.

I do not understand, are you talking about the predicate itself or the predicate object?

of course the predicate object

Can you show me what you’re doing? because technically any character should go without needing to do “escape” in the field “string” of a predicate.

because there are too many dirty data, i even don’t know how many other special characters it have.

so maybe i need to clean these characters first, but i just want to know if dgraph can escape these.

Hey,

I have same issue.
I am using some special character, getting error.

My scenario is I have a text field, in which user can enter there qualities, so user can use number format like
1)
2)…
and can also use bullet format or any others
Its throwing error.

And as my input field is text-box, user can also use enter which is also throwing error.

I don’t know what to do, please help.

Thanks

Can you show your mutation? (an example)

@Suman please share your example for mutation as well as the schema for reference.

Hi,

Right now my main concern is next line issue, so data regarding that are

Schema is

correspondence_address: string .

Mutation

{
set {
<0x155e> <correspondence_address> "wiurnvioru oiintroi irrtoiror ioroitrjno ittjowi

ewufyhegiuwe uifhifuhfie"
}
}

And for bullet, I don’t have data right now, as I get bullet data I will paste the data here.

Thanks

the value should be in one line, it contain ‘\n’ in your value

@shanghai-Jerry
As I said earlier, data is from text-field so user as can add ‘\n’. So how can fix this?

In another languages, string stores multiple line data.

Here is Mutation

{
set {
<0x155e> <correspondence_address> "wiurnvioru oiintroi irrtoiror ioroitrjno ittjowi

ewufyhegiuwe uifhifuhfie"
}
}

might you should replace all \n

But its not right way you know,

User can enter there info according to there way, if I replace all \n then there data will be in single line, and its will look little odd.

And I didn’t understand why string type variable is not saving \n, is dgraph string is different from other database string.

No, it’s same. but there are some concepts you should know.

  1. in your way to mutate data, you should keep all your data in one line, otherwise, it can’t be parsed. it’s decided by RDF format.
  2. if you really want to keep \n in your value, you should try in another way.

refer: https://github.com/shanghai-Jerry/ydgraph

1 Like

@shanghai-Jerry

You are not understating my point of view

Let me explain again, if user enter data like

{
set{
<0x155e> <correspondence_address> "1) On the manifest details page add a search option to find:
a) Major Client
b) Consignee
c) Forwarder
d) Mfst#
e) Arrival Date
f) Invoice
g) HBL
" .
}}

here, if I apply your way, then I have to do something like this

{
set{
<0x155e> <correspondence_address> “On the manifest details page add a search option to find: a) Major Clientb) Consigneec) Forwarder d) Mfst# e) Arrival Date f) Invoice g) HBL Number On the major client details page add a search option to find: a) PIN# b) NAME c) CONTACT d) EMAIL On the consignee details page add a search option to find: a) NAME b) ADDRESS c) ADDRESS d) CITY e) COUNTRY f) STATE g) POSTAL h) CONTACT i) EMAIL” .
}
}

And when I get this data:

{
getdata(func: uid(0x155e)){
uid
correspondence_address
}
}

Then output will like:

{
“uid”: “0x155e”,
“correspondence_address”: “On the manifest details page add a search option to find: a) Major Clientb) Consigneec) Forwarder d) Mfst# e) Arrival Date f) Invoice g) HBL Number On the major client details page add a search option to find: a) PIN# b) NAME c) CONTACT d) EMAIL On the consignee details page add a search option to find: a) NAME b) ADDRESS c) ADDRESS\td) CITY\te) COUNTRY f) STATE\tg) POSTAL\th) CONTACT i) EMAIL”
}

Which is wrong as viewer point of view. As viewer I want my data as I have written not in this format.