considering special characters/umlauts how to encode queries with special characters (e.g. umlauts) and decode the results
Contributed by: Christian Wenz
[04/27/03 | Discuss (0) | Link to this hack]
some special characters in book titles come out bad when not specially taking care of character encoding. Same goes for queries that contain these special characters.
Solution: The Amazon API encodes data in UTF-8 format, so queries must be UTF-8-encoded, results must be UTF-8-decoded. Using PHP, this can be done as follows (search term in variable $searchterm, result in $result):
$searchterm = utf8_encode($searchterm);
$result = utf8_decode($result);