1.0.0 • Published 8 years ago

fixify v1.0.0

Weekly downloads
2
License
ISC
Repository
github
Last release
8 years ago

#About

Fixify is a one stop shop for fixing problems with text. It can remove html elements, convert html entities, decode url/uri encoded strings, and fix character encoding problems such as those observed when saving characters in one encoding format to another character encoding format without converting encoding formats. For example, saving SQL Server data from a latin1 encoded table to a windows12542 or utf8 csv file, or inserting data from a utf8 encoded table into a latin1 encoded table.

Be sure to inspect the results of your transcoding attempts carefully to make sure that you do not encounter unacceptable data loss.

#API

##fixify.fix('string', {options})

###Example Usage

var fixify = require('fixify')
var test = fixify.fix(process.argv[2])
console.log(test)

####Input

node app.js 'äóìGrampsäó and äóìOld Timer.äó'

####Output

Gramps and Old Timer.

###Options

var options = {
  fixEncoding: true
  removeHTML: true
  convertEntities: true
  decodeURI: true
  transcodingOptions: {
    bufferEncoding = 'binary'
    transcodingPattern = [
      {
        encode: 'windows1252',
        decode: 'binary'
      },
      {
        encode: 'utf8',
        decode: 'utf8'
      }
      // You can add as many encoding objects as you like
    ]
  }
}

##fixify.tanscode('string', {options})

Only transcodes and does not remove tags or decode html encoded characters.

###Options

var options = {
  bufferEncoding = 'binary'
  transcodingPattern = [
    {
      encode: 'windows1252',
      decode: 'binary'
    },
    {
      encode: 'utf8',
      decode: 'utf8'
    }
    // You can add as many encoding objects as you like
  ]
}

##fixify.analyze('string')

Accepts a string and returns an object which shows the result of encoding and decoding as various encoding formats. Will return an object with all transcoding results. Results will be 100 objects by 100 properties. You can inspect the results visually, or possible use the results to help direct an automated transcoding process.