VS Code: convert accented characters to HTML automatically - visual-studio-code

Editing an HTML file in Visual Studio Code, when I type école I want it to be replaced with école without doing any other action. What is the best solution?

Well, I'll offer this as a solution but you would have to do a lot of work to set it up first. But since no one else has offered anything, how about snippets:
"Print e-acute": {
"prefix": "é",
"body": [
"é"
],
"description": "replace é with é"
}
I've tested it and it works. But there are a lot of html character entity references to input. If you were really good you could make a program to grab the list and create the snippets for entities 161-255 automatically. I'm surprised there isn't an extension already available for this.

Related

Show special characters in VS Code

I have a problem with my VS Code. When trying to modify a file that contains special characters like "á", "ñ", "ó" etc., the special characters are replaced with a question mark. (See image below.)
Although, this can be solved easily from the back of Visual Studio Code, changing the language type to "Windows 1252", because at first it worked for me. But now, even if I change it to that language, the signs are still there.
the files that you opened before you made the changes to the encoding have been auto-overwritten and the original characters were replaced with the unknown-character character

String or string literal fails

I am trying something simple to follow exercises in a book. For example, typing “hello” at the prompt in the interactions window.
I get the the following error:
“a”: unbound identifier in module in: “a”
I believe simple things like this worked before, so I want to know what to check to resolve this problem.
Your problem are the quotation marks, a very common problem. Look:
“a”
The quotation marks look italic.
They should be like this: "a".
Copy paste this into your REPL and print return (this time it will work!):
"hello"
This is written with the right quoation marks "" and not “” .
If you copy paste from pdf books somteims this wrong quotation marks appear as a result (like Realm of Racket - because recently I had that problem when copy pasting from it). (Quotation marks from MS Word when using Times Romans fonts are also from this strange type, and in some programming blogs, too, the quotation marks are spoiled when copy pasting out of them).
How to avoid it?: Type the examples manually into the DrRacket editor. - problem solved! Plus you learn the things anyway much better if you type them yourself - ("the hard way" approach ;) ).
And you learn, that even copy pasting is a skill which one sometimes has to learn anew - welcome to programming (the long road of learning) :D .
Remember to enter the quotes " around the hello too.
"hello" is a string which contains the text hello
hello is a name of an variable (an identifier),
so if you haven't defined the name hello you get an
error saying that the identifier is undefined

Microsoft Word: Camel Case Typing

Does anyone know if there is a shortcut, feature or plugin available for Microsoft Word that can make highlighted text or styles in method camel case, so variableName not just ClassName.
I know there is the Capitalise Each Word shortcut but this also capitalises the first word.
I know its not really Programmy but its worth a shot, cheers!
Like so many things MicroSoft, they develope an application until it is works for 80% the cases it should support and call it done.
None of their office word application have any concept of a "Camel Case" word such as "camelCaseWord".
In my case, I would like a spell check to make each word in a camel case word to spell check independently.
In your case, I would suggest you create your own macro that would capitalize the first letter of each word in the selected text then remove the spaces between words. In fact someone already wrote one:
Convert Highlighted Text revised

Apostrophe issue in RTF

I have a function within a custom CRM web application (old VB.Net circa 2003) that takes a set of fields from a database and merges them with palceholders in a set of RTF based template documents. These generate merged letters and documentation. The code essentially loops through each line of the RTF template file and replaces any instances of the placeholder values with text from a database record. The issue I'm having is that users have pasted a certain type of apostrophe into the web app (and therefore into the database) that is not rendering correctly in the resulting RTF file. It is rendering like this - ’.
I need a way to spot this invalid apostrophe in the code and replace it with a valid one. Unfortunately when I paste the invalid apostrophe into the Visual Studio editor it gets converted into the correct one. So I need another way to express this invalid apostrophe's value. Unfortunately I do not know a great deal about unicode and other encodings so I'm calling out for help with this.
Any ideas?
If you really just want to figure out what the character is you might want to try and paste it into a text editor like ultraedit. It has a hex mode that you can flip to to see the actual underlying bytes.
In order to do the replace once you've figured out the character you'd do something like this in Vb,
text.Replace(ChrW(2001), "'")
Note that you might not be able to figure it out easily using the text editor because it might also get mangled by paste from the clipboard. You might want to either print some debug of the ascii values from code. You can use the AscW function to do that.
I can't help but think that it may actually simply be a case of specifying the correct encoding to use when you write out the stream though. Assuming you're using a StreamWriter you can specify it on the constructor. I'm guessing you actually want ASCII given your requirement.
oWriter = New System.IO.StreamWriter(path, False, System.Text.Encoding.ASCII)
It looks like you probably want to encode characters out of the 8 bit range (>255).
You can do that using \uNNNN according to the wikipedia article.

Japanese characters in a latex \section{} cause an error

I am working on getting Japanese documents created with latex. I have installed the latest version of texlive-2008 which includes CJK.
In my document I have the following:
\documentclass{class}
\usepackage{CJK}
\begin{document}
\begin{CJK*}{UTF8}{min}
\title{[Japanese Characters here 1]}
\maketitle
\section{[Japanese Characters here 2]}
[Japanese Characters here 3]
\end{CJK*}
\end{document}
In the above code there are 3 locations Japanese characters are used.
1 + 3 work fine whereas 2, which contains Japanese characters in a \section{} fails with the following error.
! Argument of \#sect has an extra }.
After some research it turns out this error manifests when you’ve put a fragile command inside a moving argument. A moving argument because section can be moved to a contents page for example.
Does anyone know how to get this to work and why latex thinks Japanese characters are "fragile".
Sorry to post this as an answer rather than a comment to your answer; I don't have enough rep yet to comment. (EDIT: Now I have enough rep to comment, but I'm not sorry anymore. Thanks Will.)
Your solution of replacing
\section{[Japanese Text]}
with
\section{\texorpdfstring{[Japanese Text]}{}}
suggests that you're using the hyperref package. When you use the hyperref package, any sort of not-totally-boring text (e.g. math) within \section causes a problem because \section is having trouble generating pdf bookmarks. \texorpdfstring allows you to specify how you want the section title to appear in the pdf bookmark. For example, I might write
\section{Calculation of \texorpdfstring{$H_2(\mathcal{X})$}{H\_2(X)}}
if I want the section title to be "Calculation of $H_2(\mathcal{X})$" but I want the pdf bookmark to be "Calculation of H_2(X)".
You should probably use xetex/xelatex, as it has been created to support unicode. The change is sometimes not easy for already existing documents, though. (xelatex should be included in texlive, it is just different executable to call -- this is how it is done in Debian).
I have managed to get this working now!
Using Latex and CJK as before.
\section{[Japanese Text]}
was replaced with
\section{\texorpdfstring{[Japanese Text]}{}}
Now the contents pages and section titles work and update fine.