Skip to content

Commit

Permalink
Revert "fix base64 encode for non ASCII chars"
Browse files Browse the repository at this point in the history
This reverts commit f9c2d32.
  • Loading branch information
mzaks committed Apr 2, 2024
1 parent 4354a18 commit 5620d56
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion stdlib/src/base64/base64.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn b64encode(str: String) -> String:
@parameter
@always_inline
fn s(idx: Int) -> Int:
return int(str._as_ptr().bitcast[DType.uint8]()[idx])
return int(str._buffer[idx])

# This algorithm is based on https://arxiv.org/abs/1704.00605
var end = length - (length % 3)
Expand Down
3 changes: 0 additions & 3 deletions stdlib/test/base64/test_base64.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ fn test_b64encode():
# CHECK: SGVsbG8gTW9qbyEhIQ==
print(b64encode("Hello Mojo!!!"))

# CHECK: SGVsbG8g8J+UpSEhIQ==
print(b64encode("Hello 🔥!!!"))

# CHECK: dGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==
print(b64encode("the quick brown fox jumps over the lazy dog"))

Expand Down

0 comments on commit 5620d56

Please sign in to comment.