diff --git a/src/body.js b/src/body.js
index 1b6eab1f8..a9d2e7973 100644
--- a/src/body.js
+++ b/src/body.js
@@ -306,6 +306,12 @@ function convertBody(buffer, headers) {
// html4
if (!res && str) {
res = /
中文
', 'gb2312'));
}
+ if (p === '/encoding/gb2312-reverse') {
+ res.statusCode = 200;
+ res.setHeader('Content-Type', 'text/html');
+ res.end(convert('中文
', 'gb2312'));
+ }
+
if (p === '/encoding/shift-jis') {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/html; charset=Shift-JIS');
diff --git a/test/test.js b/test/test.js
index b8c62dc6d..c5d61c72a 100644
--- a/test/test.js
+++ b/test/test.js
@@ -2767,6 +2767,16 @@ describe('external encoding', () => {
});
});
+ it('should support encoding decode, html4 detect reverse http-equiv', function() {
+ const url = `${base}encoding/gb2312-reverse`;
+ return fetch(url).then(res => {
+ expect(res.status).to.equal(200);
+ return res.textConverted().then(result => {
+ expect(result).to.equal('中文
');
+ });
+ });
+ });
+
it('should default to utf8 encoding', function() {
const url = `${base}encoding/utf8`;
return fetch(url).then(res => {