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: GitHub - shanghai-Jerry/ydgraph: based on https://github.com/dgraph-io/dgraph

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.