AnonSec Shell
Server IP : 185.86.78.101  /  Your IP : 216.73.216.124
Web Server : Apache
System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /www/wwwroot/mifepriston.org/node_modules/buffer/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /www/wwwroot/mifepriston.org/node_modules/buffer/test/from-string.js
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
var B = require('../').Buffer
var test = require('tape')

test('detect utf16 surrogate pairs', function (t) {
  var text = '\uD83D\uDE38' + '\uD83D\uDCAD' + '\uD83D\uDC4D'
  var buf = new B(text)
  t.equal(text, buf.toString())
  t.end()
})

test('detect utf16 surrogate pairs over U+20000 until U+10FFFF', function (t) {
  var text = '\uD842\uDFB7' + '\uD93D\uDCAD' + '\uDBFF\uDFFF'
  var buf = new B(text)
  t.equal(text, buf.toString())
  t.end()
})

test('replace orphaned utf16 surrogate lead code point', function (t) {
  var text = '\uD83D\uDE38' + '\uD83D' + '\uD83D\uDC4D'
  var buf = new B(text)
  t.deepEqual(buf, new B([ 0xf0, 0x9f, 0x98, 0xb8, 0xef, 0xbf, 0xbd, 0xf0, 0x9f, 0x91, 0x8d ]))
  t.end()
})

test('replace orphaned utf16 surrogate trail code point', function (t) {
  var text = '\uD83D\uDE38' + '\uDCAD' + '\uD83D\uDC4D'
  var buf = new B(text)
  t.deepEqual(buf, new B([ 0xf0, 0x9f, 0x98, 0xb8, 0xef, 0xbf, 0xbd, 0xf0, 0x9f, 0x91, 0x8d ]))
  t.end()
})

test('do not write partial utf16 code units', function (t) {
  var f = new B([0, 0, 0, 0, 0])
  t.equal(f.length, 5)
  var size = f.write('あいうえお', 'utf16le')
  t.equal(size, 4)
  t.deepEqual(f, new B([0x42, 0x30, 0x44, 0x30, 0x00]))
  t.end()
})

test('handle partial utf16 code points when encoding to utf8 the way node does', function (t) {
  var text = '\uD83D\uDE38' + '\uD83D\uDC4D'

  var buf = new B(8)
  buf.fill(0)
  buf.write(text)
  t.deepEqual(buf, new B([ 0xf0, 0x9f, 0x98, 0xb8, 0xf0, 0x9f, 0x91, 0x8d ]))

  buf = new B(7)
  buf.fill(0)
  buf.write(text)
  t.deepEqual(buf, new B([ 0xf0, 0x9f, 0x98, 0xb8, 0x00, 0x00, 0x00 ]))

  buf = new B(6)
  buf.fill(0)
  buf.write(text)
  t.deepEqual(buf, new B([ 0xf0, 0x9f, 0x98, 0xb8, 0x00, 0x00 ]))

  buf = new B(5)
  buf.fill(0)
  buf.write(text)
  t.deepEqual(buf, new B([ 0xf0, 0x9f, 0x98, 0xb8, 0x00 ]))

  buf = new B(4)
  buf.fill(0)
  buf.write(text)
  t.deepEqual(buf, new B([ 0xf0, 0x9f, 0x98, 0xb8 ]))

  buf = new B(3)
  buf.fill(0)
  buf.write(text)
  t.deepEqual(buf, new B([ 0x00, 0x00, 0x00 ]))

  buf = new B(2)
  buf.fill(0)
  buf.write(text)
  t.deepEqual(buf, new B([ 0x00, 0x00 ]))

  buf = new B(1)
  buf.fill(0)
  buf.write(text)
  t.deepEqual(buf, new B([ 0x00 ]))

  t.end()
})

test('handle invalid utf16 code points when encoding to utf8 the way node does', function (t) {
  var text = 'a' + '\uDE38\uD83D' + 'b'

  var buf = new B(8)
  buf.fill(0)
  buf.write(text)
  t.deepEqual(buf, new B([ 0x61, 0xef, 0xbf, 0xbd, 0xef, 0xbf, 0xbd, 0x62 ]))

  buf = new B(7)
  buf.fill(0)
  buf.write(text)
  t.deepEqual(buf, new B([ 0x61, 0xef, 0xbf, 0xbd, 0xef, 0xbf, 0xbd ]))

  buf = new B(6)
  buf.fill(0)
  buf.write(text)
  t.deepEqual(buf, new B([ 0x61, 0xef, 0xbf, 0xbd, 0x00, 0x00 ]))

  buf = new B(5)
  buf.fill(0)
  buf.write(text)
  t.deepEqual(buf, new B([ 0x61, 0xef, 0xbf, 0xbd, 0x00 ]))

  buf = new B(4)
  buf.fill(0)
  buf.write(text)
  t.deepEqual(buf, new B([ 0x61, 0xef, 0xbf, 0xbd ]))

  buf = new B(3)
  buf.fill(0)
  buf.write(text)
  t.deepEqual(buf, new B([ 0x61, 0x00, 0x00 ]))

  buf = new B(2)
  buf.fill(0)
  buf.write(text)
  t.deepEqual(buf, new B([ 0x61, 0x00 ]))

  buf = new B(1)
  buf.fill(0)
  buf.write(text)
  t.deepEqual(buf, new B([ 0x61 ]))

  t.end()
})

Anon7 - 2022
AnonSec Team