Skip to content

comment about return value of atob #38653

Closed
@Schmaehgrunza

Description

@Schmaehgrunza

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/Window/atob

What specific section or headline is this issue about?

No response

What information was incorrect, unhelpful, or incomplete?

Return value

An ASCII string containing decoded data from encodedData.


An ASCII string containing decoded data from encodedData.
In the mdn article is mentioned, that the atob function would return an ASCII string ( a series of ASCII characters). ASCII is 7bit. The base 64 encoded data contains byte values from 0 to 255. That doesnt suit. Extended ASCII would contain values from 0 to 255 according to what map, Windows-1252 ,...?
The string characters of Javascript are 16 bit UTF-16 values. if it would return an Extented ASCII string,, the byte values has to be readed according a map like windows-1252, and then the characters need to be converted to unicode codepoints to save it as an Javascript UTF16 string!
Thats not the case.

What the function returns is a unicode string, which contains a series of unicode characters from unicode codepoint 0 to 255. So each character represents a two byte (16 bit) value, with values from( 0 to 255). You can get the value witch .charCodeAt(x).!

What did you expect to see?

Return value

An Unicode string containing the decoded data from encodedData as series of unicode chars from codepoint 0 to 255.

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

No response

MDN metadata

Page report details

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions