Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to escape characters in Pango markup?

Tags:

People also ask

How do you escape characters?

Escape CharactersUse the backslash character to escape a single character or symbol. Only the character immediately following the backslash is escaped. Note: If you use braces to escape an individual character within a word, the character is escaped, but the word is broken into three tokens.

How do you escape characters in a string?

\ is a special character within a string used for escaping. "\" does now work because it is escaping the second " . To get a literal \ you need to escape it using \ .

How do I escape a character in python?

To insert characters that are illegal in a string, use an escape character. An escape character is a backslash \ followed by the character you want to insert.

How do you escape characters in a string Javascript?

Javascript uses '\' (backslash) in front as an escape character. To print quotes, using escape characters we have two options: For single quotes: \' (backslash followed by single quote) For double quotes: \” (backslash followed by double quotes)


My program has a gtk.TreeView which displays a gtk.ListStore. The gtk.ListStore contains strings like this:

"<span size='medium'><b>"+site_title+"</b></span>"+"\n"+URL

Where URL is (obviously) a URL string. Sometimes there are characters in URL that cause pango to fail to parse the markup.

Is there a way to escape URL as a whole so that pango will just ignore it so it will be displayed literally? If not, how should I "escape" special characters in URLs?