Search code examples
encodingdartasciiasciiencoding

ASCII-8-BIT encoding for Dart


As I am porting an RSA library from ruby to Dart, I have get the corresponding ASCII-8-BIT value of an integer. Dart only has ASCII with representations from 0 to 127, so how can I get the other 128 characters?


Solution

  • ASCII only has 128 characters (http://en.wikipedia.org/wiki/ASCII). There is no 8-bit ASCII.

    There are lots of different extensions of ASCII that use the top 128 characters of a byte as well, sometimes called "code pages". The most common (at least in English languaged settings) are Latin-1 and Windows-1252.

    For what you are doing, you probably want the LATIN1 codec from "dart:convert".