0

I have an API which gets the company name as the query parameter and fetches the company details in JSON format.

The issue is, Name contains the Trade Mark symbol. So the API is failing and throwing an error

Example: http://localhost:8080/company/companyname=ABC TM(Trademark Symbol) Ltd

Error is:

java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986

Checked different sites but didn't find anything related to passing TM symbol in URL.

Example: http://localhost:8080/company/companyname=ABC TM(Trademark Symbol) Ltd

I want a solution to accept the trademark symbol in the URL that would work and retrieve the results.

baudsp
  • 4,076
  • 1
  • 17
  • 35
SooryaT
  • 5
  • 4
  • 1
    Have you tried properly url encoding your query string parameters? `urlencode("™") === "%E2%84%A2"` – CollinD Jan 21 '19 at 16:32
  • 1
    Refer here please: https://stackoverflow.com/questions/2742852/unicode-characters-in-urls covers passing unicode characters in url – Manoj Vadehra Jan 21 '19 at 16:33
  • https://en.wikipedia.org/wiki/Percent-encoding, https://www.urlencoder.org/, https://docs.oracle.com/javase/8/docs/api/java/net/URLEncoder.html – xerx593 Jan 21 '19 at 16:33
  • @CollinD that should really be an answer – Ferrybig Jan 21 '19 at 16:46

0 Answers0