Convert to Latex form, possible?

Is it possible to convert simple numbers and equations to latex form?

For example:
2x+5 becomes: 2x%2B5
2x^2+5 becomes: 2x%5E2%2B5
5sinx/2cosx becomes: 5sinx%2F2cosx

I need this because I am using an online calculator and I cannot simply enter /2x+5 in the url, I need to enter it in that form

Any advice?


check out EncodeUrlComponent

EDIT : Hmmm that won’t do all of them ……………
But I would start there and see what others MUST be encoded