Here is a URL with special characters:
http://localhost:4200/auth/verify-checking/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="59663c34383035643230383d2b606a6e6b686d6e6e193e34383035773a3634">[email protected]</a>&code=6XWK+4bpLA++2UfBr
The URL contains a parameter code=6XWK+4bpLA++2UfBr
where the character +
needs to be maintained.
To extract and read the parameters, the following code snippet is used:
constructor(private route: ActivatedRoute,
private authService: AuthService,
private router:Router) {
this.route.queryParams.subscribe(params => {
this.sendModel.email = params['email'];
this.sendModel.code = params['code'];
});
}
However, when attempting to send the extracted code to the server, it replaces the +
character with a blank space resulting in 6XWK 4bpLA 2UfBr
instead of the original 6XWK+4bpLA++2UfBr
. To address this issue, a custom URL serializer was created, but it failed to resolve the problem:
@Injectable()
export class CustomUrlSerializer implements UrlSerializer {
/** Parses a url into a {@link UrlTree} */
private defaultSerializer: DefaultUrlSerializer = new DefaultUrlSerializer();
// Code continues...
After injecting the custom URL serializer into the provider in core.module
, the problem persists. The issue lies in maintaining the special characters within the URL. Any suggestions on how to approach and solve this problem would be greatly appreciated.