0

I use decodeURIComponent and encodeURIComponent in Javascript. Before I store this data in a UTF-8-PostgreSQL-Database, I should decode them:

$my_data = pg_escape_string(utf8_encode($_POST['my_data']));

I'm looking for a PostgreSQL-Function to convert Javascript-Encoded Data.

2
  • This is as useful as storing binaries in the DB as base64-encoded TEXT instead of using BYTEA. Probably sometimes it has is uses but generally? Are you sure you need to do this? Commented Sep 17, 2009 at 14:49
  • milen, storing base64 is likely to reduce bandwidth required for storage/retrieval ;-) Commented Sep 18, 2009 at 6:47

1 Answer 1

2

You're not making yourself too clear, but maybe this will be of interest for you.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you, but I'm missing a more complex function: w3schools.com/jsref/jsref_encodeURI.asp
Well, there's no encodeURI function in postgresql. Maybe, there's one available as module. But I doubt you really need it. What are you trying to achieve?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.