Language used: C#
Input: An abbreviation or an emoticon.
Output: Translation of the abbreviation or emoticon
Code:
public class EmoticonController : ApiController { // GET: api/emoticon/abbreviation/shortform [HttpGet] [Route("api/emoticon/abbreviation/{shortform}")]
public string Abbreviation(string ShortForm) { string outputMessage; // Switch case that assigns the outputMessage the translation to the abbreviation entered by the user switch (ShortForm) { case "TY": outputMessage = "Thank you"; break; case "(~.~)": outputMessage = "sleepy"; break; default: outputMessage = "Invalid Input"; break; } return outputMessage; }
}
I run the above code in Visual studio and enter the URL as
localhost/api/emoticon/abbreviation/(~.~)
and I get the following error: C# URL Special characters error
PS: The screenshot URL does differ from the code and that I have mentioned. Please ignore that. I fixed it but the error still persisted.