iamacube

iamacube

I am trying to send a string of text as a body like this:

HTTPoison.post(
      "https://api.letter.net",
      '{"text": "{๐Ÿ‡บ๐Ÿ‡ธ : Hello #{message} welcome here #{number} \n ๐Ÿ‡ฏ๐Ÿ‡ต : #{number} ใ‚ˆใ†ใ“ใใ„ใ‚‰ใฃใ—ใ‚ƒใ„ใพใ—ใŸ #{message} ใƒใƒญใƒผใ‚ฆใ‚งใƒซใ‚ซใƒ \n ๐Ÿ‡ฐ๐Ÿ‡ท : #{message} ์•ˆ๋…• #{number} ์—ฌ๊ธฐ ์˜ค์‹  ๊ฒƒ์„ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค}"}',
      [{"Content-Type", "application/json"}]
    )

But I am getting this error

[error] GenServer #PID<0.780.0> terminating
** (ArgumentError) errors were found at the given arguments:

  * 1st argument: not an iodata term

    :erlang.iolist_to_binary([123, 34, 116, 101, 120, 116, 34, 58, 32, 34, 127482, 127480, 32, 58, 32, 65, 32, 110, 101, 119, 32, 114, 101, 108, 101, 97, 115, 101, 32, 110, 111, 116, 101, 115, 32, 102, 111, 114, 32, 118, 51, 46, 49, 50, 46, 48, 32, 114, 101, 108, ...])

I know that this is because of the Japanese and Korean text but I am I did not find resources on how to send something like thisโ€ฆ

Showing Posts 1 to 2

LostKobrakai

LostKobrakai

Single quotes cannot be used interchangably with double quotes in elixir. Single quotes are a used for charlists and double quotes are use for binaries, which are different datatypes.

There are a few ways to go about double quotes within binaries.

# Escape inner quotes
"{\"text\": โ€ฆ"

# Use sigil_s to have different delimiters for a binary
~s({"text": โ€ฆ)

# Don't deal with json manually and use a json library like jason to do the encoding
Jason.encode!(%{text: """
{๐Ÿ‡บ๐Ÿ‡ธ : Hello #{message} welcome here #{number} 
 ๐Ÿ‡ฏ๐Ÿ‡ต : #{number} ใ‚ˆใ†ใ“ใใ„ใ‚‰ใฃใ—ใ‚ƒใ„ใพใ—ใŸ #{message} ใƒใƒญใƒผใ‚ฆใ‚งใƒซใ‚ซใƒ 
 ๐Ÿ‡ฐ๐Ÿ‡ท : #{message} ์•ˆ๋…• #{number} ์—ฌ๊ธฐ ์˜ค์‹  ๊ฒƒ์„ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค}
"""})
iamacube

iamacube OP

Thank you for explaining, You are right!

โ€” All posts loaded โ€”

Where Next? Top

Trending in Questions Top

RSP87
Iโ€™m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I canโ€™t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
RemyXRenard
Iโ€™m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, Iโ€™ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
asweet-confluent
I recently noticed that Elixirโ€™s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New

Other Trending Topics Top

JesseHerrick
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
mudasobwa
I am happy to introduce the very ฮฑ version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, itโ€™s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! Weโ€™ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. Itโ€™s a port of GitHub - basecamp/...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews