Show More
@@ -377,6 +377,10 b' def emailuser(text):' | |||||
377 | """:emailuser: Any text. Returns the user portion of an email address.""" |
|
377 | """:emailuser: Any text. Returns the user portion of an email address.""" | |
378 | return util.emailuser(text) |
|
378 | return util.emailuser(text) | |
379 |
|
379 | |||
|
380 | def utf8(text): | |||
|
381 | """:utf8: Any text. Converts from the local character encoding to UTF-8.""" | |||
|
382 | return encoding.fromlocal(text) | |||
|
383 | ||||
380 | def xmlescape(text): |
|
384 | def xmlescape(text): | |
381 | text = (text |
|
385 | text = (text | |
382 | .replace('&', '&') |
|
386 | .replace('&', '&') | |
@@ -422,6 +426,7 b' filters = {' | |||||
422 | "urlescape": urlescape, |
|
426 | "urlescape": urlescape, | |
423 | "user": userfilter, |
|
427 | "user": userfilter, | |
424 | "emailuser": emailuser, |
|
428 | "emailuser": emailuser, | |
|
429 | "utf8": utf8, | |||
425 | "xmlescape": xmlescape, |
|
430 | "xmlescape": xmlescape, | |
426 | } |
|
431 | } | |
427 |
|
432 |
@@ -3547,6 +3547,7 b' Set up repository for non-ascii encoding' | |||||
3547 | $ hg init nonascii |
|
3547 | $ hg init nonascii | |
3548 | $ cd nonascii |
|
3548 | $ cd nonascii | |
3549 | $ python <<EOF |
|
3549 | $ python <<EOF | |
|
3550 | > open('latin1', 'w').write('\xe9') | |||
3550 | > open('utf-8', 'w').write('\xc3\xa9') |
|
3551 | > open('utf-8', 'w').write('\xc3\xa9') | |
3551 | > EOF |
|
3552 | > EOF | |
3552 | $ HGENCODING=utf-8 hg branch -q `cat utf-8` |
|
3553 | $ HGENCODING=utf-8 hg branch -q `cat utf-8` | |
@@ -3563,4 +3564,17 b" json filter should not abort if it can't" | |||||
3563 | $ HGENCODING=ascii hg log -T "{'`cat utf-8`'|json}\n" -l1 |
|
3564 | $ HGENCODING=ascii hg log -T "{'`cat utf-8`'|json}\n" -l1 | |
3564 | "\ufffd\ufffd" |
|
3565 | "\ufffd\ufffd" | |
3565 |
|
3566 | |||
|
3567 | utf8 filter: | |||
|
3568 | ||||
|
3569 | $ HGENCODING=ascii hg log -T "round-trip: {branch|utf8|hex}\n" -r0 | |||
|
3570 | round-trip: c3a9 | |||
|
3571 | $ HGENCODING=latin1 hg log -T "decoded: {'`cat latin1`'|utf8|hex}\n" -l1 | |||
|
3572 | decoded: c3a9 | |||
|
3573 | $ HGENCODING=ascii hg log -T "replaced: {'`cat latin1`'|utf8|hex}\n" -l1 | |||
|
3574 | abort: decoding near * (glob) | |||
|
3575 | [255] | |||
|
3576 | $ hg log -T "invalid type: {rev|utf8}\n" -r0 | |||
|
3577 | abort: template filter 'utf8' is not compatible with keyword 'rev' | |||
|
3578 | [255] | |||
|
3579 | ||||
3566 | $ cd .. |
|
3580 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now