-1

I'm trying to encode text of biography for Instagram change biography on profile and it doesnt accept my biography.

I used:

let bio = "111X@%(!#)!$(*!Gram)"
let biography = encodeURIComponent(bio)

and it failing. Need help please

Java equivalent to JavaScript's encodeURIComponent that produces identical output?

I need this but for NodeJS, so it generate same encoding as Java one.

JosefZ
  • 28,460
  • 5
  • 44
  • 83

1 Answers1

0

There are some distinctions between Java's URI encoding and the JS encodeURIComponent functions. Spaces will translate to + in Java but they will translate to %20 in Javascript. The JS function uses UTF-8 by default, but Java could be using a different format for encoding (depending on your code editor). Take a look at this stack overflow post for more information: https://stackoverflow.com/a/25298843/9571755

Hope that helps and happy coding :)

c0d3ster
  • 51
  • 3