我在使用gulp
版本3.8.11處理的Visual Studio 2013 wep應用程序項目中有幾個源文件。這些文件是Unicode (UTF-8 with signature) - Codepage 65001
編碼的文本文件。處理它們後,它們顯示爲Windows 1252編碼的文本文件。在Windows上使用gulp編碼問題
例如,給出以下UTF-8 encoded
src/hello.html
文件:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hello</title>
</head>
<body>
<h1>Hello, my name is Jesús López</h1>
</body>
</html>
這是它的外觀上的瀏覽器:
使用以下gulpfile.js
:
var gulp = require('gulp');
gulp.task('build', function() {
gulp.src('src/hello.html')
.pipe(gulp.dest('dist'));
});
在命令行中執行gulp build
後,這是它的外觀上的瀏覽器:
我怎樣才能解決這個編碼的問題?請幫忙。
這非常有趣。我查看了'gulp'源代碼,它似乎不可能用gulp 3將編碼選項傳遞給'gulp.src'。你可能會有一些插件的運氣。快速谷歌搜索將返回許多結果。我認爲你應該向開發者提出這個問題。 –
什麼是你的吞嚥版本? –
@Lim H.我嘗試過'gulp-convert-encoding',但沒有運氣。我在gitub https://github.com/gulpjs/gulp/issues/1037上提出了一個問題。 –