2

I've run into a issue where a redirect to an AngularJS page can contain non-ascii characters as a query parameter.

When the query contains /?id=test%F6test the value instantly turns into /?id=undefined (by Angular I presume).

Is there a nice way around this?

2
  • i think the variable is getting undefined, if you are sure variable is containing the value and available then try urlencode the variable before appending to query. Commented May 12, 2017 at 9:32
  • @atulquest93 the character is encoded, %F6 is a swedish ö character not too uncommonly used in names. Commented May 12, 2017 at 9:39

1 Answer 1

1

The Unicode code point needs to encoded into UTF-8.

For code point \u00F6, encode it as %C3%B6

console.log(window.encodeURI("testötest"));
console.log(window.encodeURI('\u00F6'));

%F6 must never appear in a valid UTF-8 sequence.

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

1 Comment

Ok, apparently there are some issues on the source side then. I assumed (never should have) that they encoded it correctly.

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.