Convert string into proper format - encoding

I have added some text in DB containing curly quotes . So need to change the character encoding which changes curly quotes and similar different style symbols into normal quotes and symbols.
Sample as shown below :
Issue as shown below: Hi This is “text“
Required as per this: Hi This is "text"

Related

Text String Over-Bar not working with simple back-slash

I want to learn how to place and overbar on text string.
I tried the back slash on a text string and it did not work, does this trick only work on pin names?

VS Code - Select Current Word in JSON Files Includes Quotes

Using cmd+d to select the current word in VS Code also annoyingly selects any quotes that may surround the word. Is there any way to prevent this?
Edit: This appears to only happen in JSON files.
I can't reproduce the quotes selection with Cmd+D but I can with the Expand Selection command..
If you still have this issue. it may be fixed in vscode v1.69. The quotes will no longer be considered part of a json word. From the release notes:
Every language comes with a word pattern that defines which characters
belong to a word when in that language. JSON was different to all
other language in that it included the quotes of string literals and
the full string literal content. It now follows other languages and
contains just letters, numbers and hyphens.
The change will fix issues when expanding the selection (Command: Expand Selection), allow word completions inside strings and fix some
quick suggestion abnormalities.

Swift Difference Between Literal And String Newline Characters

I have a Swift application for iOS where inherit from XMLParser to parse an XML file. In one section I grab an attribute which may contain \n characters. These strings are used as button titles later.
Sample XML:
<button title="TitleLine1\nTitleLine2"/>
And in my didStartElement() function:
var buttonTitle : String = attributeDict["title"]
This grabs the title just as I would expect, however later when I create the button and apply the title, the newline character is simply printed right in line on the button instead of making the button title two lines.
I expect the button to look like this:
TitleLine1
TitleLine2
But it ends up being:
TitleLine1\nTitleLine2
If I forget the XML parsing altogether and simply hard code the button title with a literal string like this, the newline works:
button.setTitle("TitleLine1\nTitleLine2", for: .normal)
However setting it with my variable results in the newline being printed in line:
button.setTitle(buttonTitle, for: .normal)
Is there some different way the XMLParser handles strings? I notice the same behavior if I simply do a print() with the XML parsed string vs a literal string.
A \n in a Swift string literal is converted to an actual newline character during compilation.
The character \ followed by the character n in some piece of text obtained at runtime has no special meaning of any kind.
You have a few choices. When you parse the XML, you can process all strings and replace occurrences of the character sequence \n with an actual newline character:
let str = someXMLValue.replacingOccurrences(of: "\\n", with: "\n")
Another option is to change your XML structure to use an element for the title instead of an attribute. Then you can put a real newline in the title:
<button>
<title>TitleLine1
TitleLine2</title>
</button>
Then your Swift code doesn't need to do anything special to deal with newlines.

Meteor - escape quoted text (svg) stored in mongodb

I'd like to store an svg inside a MongoDB record with Meteor. However, when I output it with Blaze like so:
{{svgFile}}
...it is quoted, and the quoted text is displayed instead of the svg image. How can I just display the raw contents of it instead of the quoted text?
You need to use the triple bracket syntax to render HTML (or SVG) strings as DOM elements :
{{{svgFile}}}

How to produce Unicode characters with Matlab LaTex interpreter

I have the following line of code
ylabel('Średnia wartość parametru $f_{max}$','Interpreter','latex');
and would like to use it as a label for my plot. Unfortunately what I actually get is:
Warning: Unable to interpret LaTeX string
If I remove Unicode characters like so:
ylabel('Srednia wartosc parametru $f_{max}$','Interpreter','latex');
it works with no problem.
So how could I make Matlab print those unfortunate characters?
Use LaTeX representations for those characters: \'S, \'s, etc. And don't forget to duplicate quote signs within the string:
ylabel('\''Srednia warto\''s\''c parametru $f_{max}$','Interpreter','latex')