Inserting a Newline Character Using Vi
To insert a newline character, i.e. to create a new line in a file
using Vi on a Unix system, you can use
to actually type Ctrl-V
(i.e. the Ctrl
keys hit simultaneously) followed by Enter
to get the
to appear. For example, suppose that instead of commas separating elements
in a list you wish to put each element on a new line.
Gold, Silver, Bronze
You can use the following command in Vi to replace all commas
with the newline character starting from the first line in the file
to the last (represented by
As noted above, you need to hit Ctrl-V Enter to put the
^M in the command.
How to represent a new line character in a regex in VI?
Date: December 30, 2006
Character Encoding of Webpages
I've been validating the HTML code on the webpages I create for a few
weeks using the W3C Markup Validation
. For all of my webpages, I've been getting the warning below
when I validate them:
No Character encoding declared at document level
No character encoding information was found within the document, either in
an HTML meta element or an XML declaration. It is often recommended to declare
the character encoding in the document itself, especially if there is a chance
that the document will be read from or saved to disk, CD, etc.
The W3C site provides information on character sets and encoding of webpages
Tutorial: Character sets & encodings in XHTML, HTML and CSS
There are, of course, many other useful references on the matter on the web.
The Wikipedia article,
Character encodings in HTML explains how browsers
determine the character encoding of a webpage. Wikipedia provides
information on issues related to the internationalization and
localization, often abbreviated as
i18n (where 18 stands for the number of letters between the i and the n
in internationalization, a usage coined at DEC in the 1970s or 80s) and L10n
respectively. The capital L in L10n helps to distinguish it from the lowercase
i in i18n.
The Securet of Character Encoding has a good explanation of why
it is advisable to specify the character encoding for your HTML
documents and why using UTF-8 is recommended.
The webserver is providing information on the encoding of the webpages, i.e.
it is sending
Content-Type: text/html; charset=UTF-8 in the
HTTP headers it sends to browsers, but I haven't been including a meta tag in
the pages specifying the encoding, i.e. I haven't been using
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">. I decided to add that immediately after the
<head> tag in the template I use for my webpages.