Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. text-encoding
  2. ==============
  3. This is a polyfill for the [Encoding Living
  4. Standard](https://encoding.spec.whatwg.org/) API for the Web, allowing
  5. encoding and decoding of textual data to and from Typed Array buffers
  6. for binary data in JavaScript.
  7. By default it adheres to the spec and does not support *encoding* to
  8. legacy encodings, only *decoding*. It is also implemented to match the
  9. specification's algorithms, rather than for performance. The intended
  10. use is within Web pages, so it has no dependency on server frameworks
  11. or particular module schemes.
  12. Basic examples and tests are included.
  13. ### Install ###
  14. There are a few ways you can get and use the `text-encoding` library.
  15. ### HTML Page Usage ###
  16. Clone the repo and include the files directly:
  17. ```html
  18. <!-- Required for non-UTF encodings -->
  19. <script src="encoding-indexes.js"></script>
  20. <script src="encoding.js"></script>
  21. ```
  22. This is the only use case the developer cares about. If you want those
  23. fancy module and/or package manager things that are popular these days
  24. you should probably use a different library.
  25. #### Package Managers ####
  26. The package is published to **npm** and **bower** as `@sinonjs/text-encoding`.
  27. Use through these is not really supported, since they aren't used by
  28. the developer of the library. Using `require()` in interesting ways
  29. probably breaks. Patches welcome, as long as they don't break the
  30. basic use of the files via `<script>`.
  31. ### API Overview ###
  32. Basic Usage
  33. ```js
  34. var uint8array = new TextEncoder().encode(string);
  35. var string = new TextDecoder(encoding).decode(uint8array);
  36. ```
  37. Streaming Decode
  38. ```js
  39. var string = "", decoder = new TextDecoder(encoding), buffer;
  40. while (buffer = next_chunk()) {
  41. string += decoder.decode(buffer, {stream:true});
  42. }
  43. string += decoder.decode(); // finish the stream
  44. ```
  45. ### Encodings ###
  46. All encodings from the Encoding specification are supported:
  47. utf-8 ibm866 iso-8859-2 iso-8859-3 iso-8859-4 iso-8859-5 iso-8859-6
  48. iso-8859-7 iso-8859-8 iso-8859-8-i iso-8859-10 iso-8859-13 iso-8859-14
  49. iso-8859-15 iso-8859-16 koi8-r koi8-u macintosh windows-874
  50. windows-1250 windows-1251 windows-1252 windows-1253 windows-1254
  51. windows-1255 windows-1256 windows-1257 windows-1258 x-mac-cyrillic
  52. gb18030 hz-gb-2312 big5 euc-jp iso-2022-jp shift_jis euc-kr
  53. replacement utf-16be utf-16le x-user-defined
  54. (Some encodings may be supported under other names, e.g. ascii,
  55. iso-8859-1, etc. See [Encoding](https://encoding.spec.whatwg.org/) for
  56. additional labels for each encoding.)
  57. Encodings other than **utf-8**, **utf-16le** and **utf-16be** require
  58. an additional `encoding-indexes.js` file to be included. It is rather
  59. large (596kB uncompressed, 188kB gzipped); portions may be deleted if
  60. support for some encodings is not required.
  61. ### Non-Standard Behavior ###
  62. As required by the specification, only encoding to **utf-8** is
  63. supported. If you want to try it out, you can force a non-standard
  64. behavior by passing the `NONSTANDARD_allowLegacyEncoding` option to
  65. TextEncoder and a label. For example:
  66. ```js
  67. var uint8array = new TextEncoder(
  68. 'windows-1252', { NONSTANDARD_allowLegacyEncoding: true }).encode(text);
  69. ```
  70. But note that the above won't work if you're using the polyfill in a
  71. browser that natively supports the TextEncoder API natively, since the
  72. polyfill won't be used!
  73. You can force the polyfill to be used by using this before the polyfill:
  74. ```html
  75. <script>
  76. window.TextEncoder = window.TextDecoder = null;
  77. </script>
  78. ```
  79. To support the legacy encodings (which may be stateful), the
  80. TextEncoder `encode()` method accepts an optional dictionary and
  81. `stream` option, e.g. `encoder.encode(string, {stream: true});` This
  82. is not needed for standard encoding since the input is always in
  83. complete code points.