jeudi 23 avril 2015

Encoding problems with gulp on Windows

I have several source files in a Visual Studio 2013 wep application project that I process using gulp. Those files are Unicode (UTF-8 with signature) - Codepage 65001 encoded text files. After process them, they appear as they were Windows 1252 encoded text files.

For example, given the following UTF-8 encoded src/hello.html file:

<!DOCTYPE html>
<html xmlns="http://ift.tt/lH0Osb">
<head>
    <title>Hello</title>
</head>
<body>
    <h1>Hello, my name is Jesús López</h1>
</body>
</html>

This is how it looks on the browser:

enter image description here

Using the following gulpfile.js:

var gulp = require('gulp');

gulp.task('build', function () {
    gulp.src('src/hello.html')
        .pipe(gulp.dest('dist'));
});

After executing gulp build on the command line. This is how it looks on the browser:

enter image description here

How can I solve this encoding problem? Please help.




Aucun commentaire:

Enregistrer un commentaire