Search API returned {“errors”:[{“message”:“Could not authenticate you”,“code”:32}]}



I used C++ libraries twitcurl.
When I call the search method and the query word contain some reserved characters, e.g., #, %, &, the method will return {“errors”:[{“message”:“Could not authenticate you”,“code”:32}]}.
I have encoded query using percent-encoding, e.g., #haiku => %23haiku, the error is still returned.
I wonder how could I deal with the problem? Thanks.