Skip to content

AngularJS factory and filters for Non Lossy Ascii String Encoding (7-bit verbose ASCII to represent all Unicode characters).

License

Notifications You must be signed in to change notification settings

UEGMobile/angular-nonlossyascii

Repository files navigation

angular-nonlossyasscii

AngularJS factory and filters for Non Lossy Ascii String Encoding (7-bit verbose ASCII to represent all Unicode characters).

Build Status

Important

My first recommendation to encode strings on any system is UTF-8. But if you need compatibility with an existing platform, you can use this js.

Installation

You can install this package either with npm or with bower.

npm

npm install angular-nonlossyascii --save

Then add NonLossyAscii as a dependency for your app:

angular.module('myApp', [require('NonLossyAscii')]);

bower

bower install angular-nonlossyascii --save

Add a <script> to your index.html:

<script src="/bower_components/angular-nonlossyascii/angular-nonlossyascii.min.js"></script>

Then add NonLossyAscii as a dependency for your app:

angular.module('myApp', ['NonLossyAscii']);

Usage

Require the module in your app and call:

NLAscii.encodeToNonLossyAscii(text) 

and

NLAscii.decodeFromNonLossAscii(text).

Example:

// add the angular-nonlossyasscii module to your app
myapp = angular.module('myapp', ['NonLossyAscii']);

// inject it into your component
myapp.factory('FancyFactory', function(NLAscii){
  return {
    codeThatNeedsNonLossAscii: function() {
      return NLAscii.encodeToNonLossyAscii("El trozo de texto est\341ndar de Lorem Ipsum usado desde el a\361o 1500");
    }
  };
});

You can also decode strings.

NLAscii.encodeToNonLossyAscii("El trozo de texto estándar de Lorem Ipsum usado desde el año 1500");
// El trozo de texto est\341ndar de Lorem Ipsum usado desde el a\361o 1500

You can also use on twig templates to decode from Non Loss Ascii encoding:

<span>{{ varText | NLAscii }}</span>

References

About

AngularJS factory and filters for Non Lossy Ascii String Encoding (7-bit verbose ASCII to represent all Unicode characters).

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published