Answer the question
In order to leave comments, you need to log in
How to convert project files from CP866 to UTF-8?
In general, you need to convert project files from cp866 encoding to utf-8.
I try like this
find project/method_pay -name "*.*" -exec iconv -f CP866 -t UTF-8 {} -o target/{} \;
iconv: -o: No such file or directory
iconv: target/project/method_pay/method_pay_json.php: No such file or directory
const gulp = require('gulp');
const convertEncoding = require('gulp-convert-encoding');
gulp.task('default', function () {
return gulp.src('project/method_pay/*.*')
// .pipe(convertEncoding({to: 'utf8'}))
.pipe(convertEncoding({decode: 'CP866', encode: 'utf8'}))
.pipe(gulp.dest('dist'));
});
[email protected] start /Users/fast/Sites/untitled
> gulp
[16:54:45] Using gulpfile ~/Sites/untitled/gulpfile.js
[16:54:45] Starting 'default'...
[16:54:45] 'default' errored after 8.48 ms
[16:54:45] Error in plugin 'gulp-convert-encoding'
Message:
At least one of `from` or `to` required
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `gulp`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/fast/.npm/_logs/2017-07-08T13_54_45_124Z-debug.log
BRAIN:untitled fast$
Answer the question
In order to leave comments, you need to log in
enconv file.txt
dos2unix file.txt
Try Python
import codecs
import os
for root, dirs, files in os.walk('.'):
for file in files:
f = codecs.open(file, "r", "cp866")
contents = f.read()
f.close()
f = codecs.open(file, "w", "utf-8")
f.write(contents)
f.close()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question