shahryarjb
How to decode and print base64 with unprintable character
Hi, I have a encoded64 string that I want to decode and print as string, it should be human readable
Example:
iex(33)> {:ok, bb} = Base.decode64("g2gCbQAAAA5zaGFocnlhcnMtaU1hY20AAAAIYcJbhqjzRj4=")
{:ok,
<<131, 104, 2, 109, 0, 0, 0, 14, 115, 104, 97, 104, 114, 121, 97, 114, 115, 45,
105, 77, 97, 99, 109, 0, 0, 0, 8, 97, 194, 91, 134, 168, 243, 70, 62>>
Now how can convert bb to string?
Thank you.
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Using Phoenix.LiveView.TagEngine as an EEx.Engine is deprecated!
To compile HEEx, use Phoenix.LiveView.TagEngine.compile/2 instead.
Sta...
New
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app?
Looking for hints regarding:
Addi...
New
Hi all, I wanted to ask how the community is dealing with post-release steps.
Today we have Ecto migrations, which make sure that the db...
New
I am using Oban and occasionally, shortly after a deployment, a handful of jobs can fail because of dependency on other parts of the syst...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #performance










First 4 of 4 Posts
D4no0
Are you sure your decoded binary is a valid string? I try to print it using
IO.putsand I get:shahryarjb
That is my problem!!
It is something like this (based on https://www.base64decode.org):
Now in elixir how can I decode and print to see?
if I get something like this
�it should convert to codeprint.For example:
\u0000is a null characteradamu
Garbage in, garbage out. You need to determine the source of the data, and find out what format it is stored in, in order to work out how to decode it.
LostKobrakai
It’s not for sure that. It’s a best effort guess at what the source might be – replacing any unknown things with this fancy ? character. This often works ok for any single byte, possibly ascii, characters, because a lot of charsets match in the ascii characters range, but all bets are off for other characters / multi byte sequences.