Erster Commit
This commit is contained in:
21
check_encoding.js
Normal file
21
check_encoding.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const fs = require('fs');
|
||||
const filePath = 'c:\\Users\\matthias.hoesch\\.gemini\\antigravity\\scratch\\vda-to-edifact-converter\\samples\\test_efz.edi';
|
||||
const buffer = fs.readFileSync(filePath);
|
||||
|
||||
console.log('File size:', buffer.length);
|
||||
|
||||
const searchStr = 'Precision';
|
||||
const searchBuf = Buffer.from(searchStr, 'utf8');
|
||||
|
||||
let index = buffer.indexOf(searchBuf);
|
||||
if (index !== -1) {
|
||||
console.log('Found "' + searchStr + '" at byte offset:', index);
|
||||
const start = Math.max(0, index - 30);
|
||||
const end = Math.min(buffer.length, index + 40);
|
||||
const context = buffer.slice(start, end);
|
||||
console.log('Context (hex):', context.toString('hex'));
|
||||
console.log('Context (utf8):', context.toString('utf8'));
|
||||
console.log('Context (latin1):', context.toString('latin1'));
|
||||
} else {
|
||||
console.log('"' + searchStr + '" not found in file.');
|
||||
}
|
||||
Reference in New Issue
Block a user