How to transform a byte array in string as per some custom encoding schema?
up vote
0
down vote
favorite
A string "sजg" has 2 English keyboard characters and one Unicode character. It can be represented in byte array for different encoding schema as follows;
- UTF-8: [ 115, 224, 164, 156, 103 ]
- UTF-16: [ 115, 0, 28, 9, 103, 0 ]
- LB ( BigBit standard ): [ 115, 156, 18, 103]
I've written an encoder-decoder which can transform a number to a byte array and vice versa using Linked Bytes (LB) Format. How can I transform a string to byte array and vice versa?
In other words how any string encoder-decoder is implemented?
node.js utf
add a comment |
up vote
0
down vote
favorite
A string "sजg" has 2 English keyboard characters and one Unicode character. It can be represented in byte array for different encoding schema as follows;
- UTF-8: [ 115, 224, 164, 156, 103 ]
- UTF-16: [ 115, 0, 28, 9, 103, 0 ]
- LB ( BigBit standard ): [ 115, 156, 18, 103]
I've written an encoder-decoder which can transform a number to a byte array and vice versa using Linked Bytes (LB) Format. How can I transform a string to byte array and vice versa?
In other words how any string encoder-decoder is implemented?
node.js utf
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
A string "sजg" has 2 English keyboard characters and one Unicode character. It can be represented in byte array for different encoding schema as follows;
- UTF-8: [ 115, 224, 164, 156, 103 ]
- UTF-16: [ 115, 0, 28, 9, 103, 0 ]
- LB ( BigBit standard ): [ 115, 156, 18, 103]
I've written an encoder-decoder which can transform a number to a byte array and vice versa using Linked Bytes (LB) Format. How can I transform a string to byte array and vice versa?
In other words how any string encoder-decoder is implemented?
node.js utf
A string "sजg" has 2 English keyboard characters and one Unicode character. It can be represented in byte array for different encoding schema as follows;
- UTF-8: [ 115, 224, 164, 156, 103 ]
- UTF-16: [ 115, 0, 28, 9, 103, 0 ]
- LB ( BigBit standard ): [ 115, 156, 18, 103]
I've written an encoder-decoder which can transform a number to a byte array and vice versa using Linked Bytes (LB) Format. How can I transform a string to byte array and vice versa?
In other words how any string encoder-decoder is implemented?
node.js utf
node.js utf
asked Nov 10 at 1:34


Amit Kumar Gupta
3,72484865
3,72484865
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Though I've implemented it as a hack. But I'm still looking for the proper solution.
LBSequence.strToByteArr = function(str)
const byteArr = ;
for(let i=0; i< str.length; i++)
let code = str.charCodeAt(i);
byteArr.push(...LBSequence.encode(code));
return byteArr;
LBSequence.byteArrToStr = function(byteArr, start, end)
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Though I've implemented it as a hack. But I'm still looking for the proper solution.
LBSequence.strToByteArr = function(str)
const byteArr = ;
for(let i=0; i< str.length; i++)
let code = str.charCodeAt(i);
byteArr.push(...LBSequence.encode(code));
return byteArr;
LBSequence.byteArrToStr = function(byteArr, start, end)
add a comment |
up vote
0
down vote
Though I've implemented it as a hack. But I'm still looking for the proper solution.
LBSequence.strToByteArr = function(str)
const byteArr = ;
for(let i=0; i< str.length; i++)
let code = str.charCodeAt(i);
byteArr.push(...LBSequence.encode(code));
return byteArr;
LBSequence.byteArrToStr = function(byteArr, start, end)
add a comment |
up vote
0
down vote
up vote
0
down vote
Though I've implemented it as a hack. But I'm still looking for the proper solution.
LBSequence.strToByteArr = function(str)
const byteArr = ;
for(let i=0; i< str.length; i++)
let code = str.charCodeAt(i);
byteArr.push(...LBSequence.encode(code));
return byteArr;
LBSequence.byteArrToStr = function(byteArr, start, end)
Though I've implemented it as a hack. But I'm still looking for the proper solution.
LBSequence.strToByteArr = function(str)
const byteArr = ;
for(let i=0; i< str.length; i++)
let code = str.charCodeAt(i);
byteArr.push(...LBSequence.encode(code));
return byteArr;
LBSequence.byteArrToStr = function(byteArr, start, end)
answered Nov 10 at 7:29


Amit Kumar Gupta
3,72484865
3,72484865
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53235277%2fhow-to-transform-a-byte-array-in-string-as-per-some-custom-encoding-schema%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown