aboutsummaryrefslogtreecommitdiff
path: root/modules/mahonia/fallback.go
diff options
context:
space:
mode:
author无闻 <u@gogs.io>2014-12-22 05:30:49 -0500
committer无闻 <u@gogs.io>2014-12-22 05:30:49 -0500
commite193005c66e3c61593efd2d44005efbca0fab33a (patch)
treeb5e51343456338eeea89d09bb24d93e7142f5d99 /modules/mahonia/fallback.go
parentebbe6177a91e9eb6b4001342728ff099cafd5d65 (diff)
parentfff8109567f8296f81954dbf6280eb3049bb3db8 (diff)
Merge pull request #773 from phsmit/golang_x_text_encoding
Golang x text encoding
Diffstat (limited to 'modules/mahonia/fallback.go')
-rw-r--r--modules/mahonia/fallback.go19
1 files changed, 0 insertions, 19 deletions
diff --git a/modules/mahonia/fallback.go b/modules/mahonia/fallback.go
deleted file mode 100644
index 27259c5d..00000000
--- a/modules/mahonia/fallback.go
+++ /dev/null
@@ -1,19 +0,0 @@
-package mahonia
-
-// FallbackDecoder combines a series of Decoders into one.
-// If the first Decoder returns a status of INVALID_CHAR, the others are tried as well.
-//
-// Note: if the text to be decoded ends with a sequence of bytes that is not a valid character in the first charset,
-// but it could be the beginning of a valid character, the FallbackDecoder will give a status of NO_ROOM instead of
-// falling back to the other Decoders.
-func FallbackDecoder(decoders ...Decoder) Decoder {
- return func(p []byte) (c rune, size int, status Status) {
- for _, d := range decoders {
- c, size, status = d(p)
- if status != INVALID_CHAR {
- return
- }
- }
- return 0, 1, INVALID_CHAR
- }
-}