Mercurial > hg
annotate templates/atom/error.tmpl @ 9424:799373ff2554
highlight: fixes garbled text in non-UTF-8 environment
This patch treats all files inside repository as encoded by
locale's encoding when pygmentize.
We can assume that most files are written in locale's encoding,
but current implementation treats them as UTF-8.
So there's no way to specify the encoding of files.
Current implementation, db7557359636 (issue1341):
1. Convert original `text`, which is treated as UTF-8, to locale's encoding.
`encoding.tolocal()` is the method to convert from internal UTF-8 to local.
If original `text` is not UTF-8, e.g. Japanese EUC-JP, some characters
become garbled here.
2. pygmentize, with no UnicodeDecodeError.
This patch:
1. Convert original `text`, which is treated as locale's encoding, to unicode.
Pygments prefers unicode object than raw str. [1]_
If original `text` is not encoded by locale's encoding, some characters
become garbled here.
2. pygmentize, also with no UnicodeDecodeError :)
3. Convert unicode back to raw str, which is encoded by locale's.
.. [1] http://pygments.org/docs/unicode/
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 29 Aug 2009 15:24:15 +0900 |
parents | 1de6e7e1bb9f |
children |
rev | line source |
---|---|
7749
f32af51aaee5
hgweb: add atom error template
Sune Foldager <cryo@cyanite.org>
parents:
diff
changeset
|
1 {header} |
f32af51aaee5
hgweb: add atom error template
Sune Foldager <cryo@cyanite.org>
parents:
diff
changeset
|
2 <!-- Error --> |
f32af51aaee5
hgweb: add atom error template
Sune Foldager <cryo@cyanite.org>
parents:
diff
changeset
|
3 <id>{urlbase}{url}</id> |
f32af51aaee5
hgweb: add atom error template
Sune Foldager <cryo@cyanite.org>
parents:
diff
changeset
|
4 <link rel="self" href="{urlbase}{url}atom-log"/> |
f32af51aaee5
hgweb: add atom error template
Sune Foldager <cryo@cyanite.org>
parents:
diff
changeset
|
5 <link rel="alternate" href="{urlbase}{url}"/> |
f32af51aaee5
hgweb: add atom error template
Sune Foldager <cryo@cyanite.org>
parents:
diff
changeset
|
6 <title>Error</title> |
f32af51aaee5
hgweb: add atom error template
Sune Foldager <cryo@cyanite.org>
parents:
diff
changeset
|
7 <updated>1970-01-01T00:00:00+00:00</updated> |
f32af51aaee5
hgweb: add atom error template
Sune Foldager <cryo@cyanite.org>
parents:
diff
changeset
|
8 <entry> |
f32af51aaee5
hgweb: add atom error template
Sune Foldager <cryo@cyanite.org>
parents:
diff
changeset
|
9 <title>Error</title> |
8936
1de6e7e1bb9f
change wiki/bts URLs to point to new hostname
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
7749
diff
changeset
|
10 <id>http://mercurial.selenic.com/#error</id> |
7749
f32af51aaee5
hgweb: add atom error template
Sune Foldager <cryo@cyanite.org>
parents:
diff
changeset
|
11 <author> |
f32af51aaee5
hgweb: add atom error template
Sune Foldager <cryo@cyanite.org>
parents:
diff
changeset
|
12 <name>mercurial</name> |
f32af51aaee5
hgweb: add atom error template
Sune Foldager <cryo@cyanite.org>
parents:
diff
changeset
|
13 </author> |
f32af51aaee5
hgweb: add atom error template
Sune Foldager <cryo@cyanite.org>
parents:
diff
changeset
|
14 <updated>1970-01-01T00:00:00+00:00</updated> |
f32af51aaee5
hgweb: add atom error template
Sune Foldager <cryo@cyanite.org>
parents:
diff
changeset
|
15 <content type="text">{error|escape}</content> |
f32af51aaee5
hgweb: add atom error template
Sune Foldager <cryo@cyanite.org>
parents:
diff
changeset
|
16 </entry> |
f32af51aaee5
hgweb: add atom error template
Sune Foldager <cryo@cyanite.org>
parents:
diff
changeset
|
17 </feed> |