what characters are allowed in google search structured data - json-ld

I want to use google rich search results with structured data.
I'm confused about what characters the description tag can take.
For example, I want to use
{ description: "this is a backslash \ here" }
I know JSON does not allow a backslash without escaping
My question is if I replace the \ with \u005C' like this
{ description: "this is a backslash \u005C here" }
Will this display \ on the rendered page or will it display '\u005C'

Google will parse the data using the json rules so will most likely see it as a backslash.
A way to get an idea is to run a comment like this in your browsers console.
console.log({ description: "this is a backslash \u005C here" });
This also results in the backslash:
console.log({ description: "this is a backslash \\ here" });
Google does do its own post processing of the strings it sees. e.g. it will most likely remove any html and some emojis.
And sometimes even Google has a bug in the way they encode/decode that can cause strange outputs.
The only way to know for certain is to test. But I think you will be fine as in this case the encoding is dealt with via json.

Related

Send multi-line signature to Metamask via web3js

Checked all the similar questions suggested and couldn't find an answer, unfortunately.
Is there a way to send a multi-line message to metamask via web3.eth.personal.sign as the first parameter? (The problem is how to get multiple lines, not how to actually send a message there)
A more eloquent example of my question can be seen in the image attached. There are multiple paragraphs on separate lines: 'Welcome to OpenSea!', 'Click "Sign" to sign in..." etc.
Thanks a lot!
You can either use \n or use instead of '' or "" when you send the message. The option with takes the spacing in the content into consideration (in js).

google structured data testing tool displays question mark character instead of utf-8 characters

After testing URL in the google structured data testing tool, I don't know why the question mark character is shown instead of utf-8 characters?
what is wrong? any help really appreciated.
the url is : link
and the result image:
The underlying json is:
don't know why, but the structured data tool doesn't understand your farsi. If farsi is an encoded javascript, like \u0645\u0648\u0633\u0633\u0647 - there is no problem. But if it is written like علائم تیروئید کم کار - something wired happens.
Fast and dirty solution: encode all of your structured data content as encoded javascript. In Notepad++ this makes a plugin named HTML Tag - then ctrl+j.

Google Structured Data Testing Tool not validating on first load

I'm using Google's Structured Data Testing Tool to investigate why Google isn't finding any structured data on my page.
On first loading the URL (https://www.languagesunited.co.uk), I get an "Uncategorised Error":
JSON-LD Missing '}' or object member name.
Within the test tool source windows, I can making a small change to the page (add a space somewhere) and re-run the validation, and it validates (except for the url needing to be www.example.com for the tool to work).
I'd be grateful for any advice if anyone has had a similar problem.
After some experimenting with different options and getting different results with the test tool, the answer was very simple. There were some invalid whitespace characters in my structured data. Switching on the "show invisibles" option in my editor allowed me to replace these with spaces, and the data validated successfully.
Both are, most likely, bugs in the SDTT.
If you paste the markup (instead of letting it fetch the URL), the SDTT detects the structured data immediately (letting it fetch first and then editing something in the detected markup is the same idea). So there’s probably something wrong with their URL fetching.
For the issue with the example domain, see these questions:
Google structured data error: “All values provided for http://www.example.com/ must have the same domain.”
Google SDTT error: “All values provided for http://www.example.com/ must have the same domain.”
Schema.org and ContactPoint use with validation failure: “All values provided for http://www.example.com/ must have the same domain.” (on Webmasters SE)
I've just realized that Google Structured Data Validation Tool requires you (or us) to include context, In example:
'#context': 'https://schema.org',
(schema.org includes it in all their examples, i.e.:
Example encoded as JSON-LD in a HTML script tag.
<script type="application/ld+json">
{
"#context": "https://schema.org/",
"#type": "Person",
"name": "Christopher Froome",
"sponsor":
{
"#type": "Organization",
"name": "Sky",
"url": "http://www.skysports.com/"
}
}
</script>
If you do so you will start getting results again.

Can alchemylanguage be used to analyze text without url?

In the demo, it can analyze plain text
But in the API reference all REST APIs require url. And they don't seem to support analyze text directly. I tried to use text in a POST form anyway. But I got error.
{
"status": "ERROR",
"statusInfo": "invalid-url"
}
This is more a documentation issue, than a coding issue. In the documentation you will see three buttons. Select the Text one to get the documentation on Text calls.

DotNetNuke Event Logging format

Using DotNetNuke 5.
I am using the EventLogController along with LogInfo to add custom messages to the event logs in dot net nuke.
Within LogInfo we have a method to Add a Property/Value. I am under the assumption that the Controller.AddLog(logInfo) converts the properties & vlaues into XML using the LogInfo->Serialize method for DNN to store it.
My problem is that I want linebreaks in my message. Is there anyway I can add a newline. "\r\n" wouldn't work, wouldn't work, CDATA escaped wouldn't work. Everything gets escaped through the Log function.
How do I pretty print the log message myself?
Regards, V
Sadly, due to the HTML encoding that is done on all messages, you are going to be out of luck trying to do this in the DNN event Log.
Depending on what/where you are, you have a few options.
You can add them as individual detail lines using properties, see my example below.
You could report on something yourself, using a custom log table or something similar
If you are in the context of a Scheduled Job, you can log to that history, which is NOT escaped.
Examples
Log Properties
objLog = new DotNetNuke.Services.Log.EventLog.LogInfo();
objLog.AddProperty("SecureMyInstall", "Phase 2 Error Processing User Accounts");
objLog.LogTypeKey = DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.HOST_ALERT.ToString();
objLogger.AddLog(objLog);
The content of the logs is displayed as HTML, so you should be able to put <br /> to add line breaks.

Resources