utf-8 encoding in URL params


I'm accessing a web service API. This API is somehow like convert
input string to a graph.
this API has a text params. In the specification, this params should
be UTF-8 encoded.
what shall I do to ensure of this? or just pass the string to it?

The reason I'm asking is, when I pass some Chinese string to that API,
some string works fine, some string result in "messy code" in the
generated graph.

Any idea?