views:

145

answers:

2

I have to test a web app and its API for UTF-8 strings.

Webapp has a text field and its API has corresponding getter method, I have to make sure UTF-8 will work, how do I do that?

+2  A: 

You could put in characters outside of the standard ASCII set - i.e. anything above 127 or 255 in the character levels and see that they come out the other end of the API correctly.

Here is a character map generator:

http://dev.networkerror.org/utf8/

aperkins
@aperkins: +1 for the shiny tool :)
Webinator
Thanks aperkins! this is really good. I have tested string "şĀýßŗ" in webapp, it stores as it is, but API getter method shows as "??ýß?" is something wrong in the API getter method?
goutham
@goutham: Not totally sure - it would depend on a number of things. Does the page send back information using utf-8 encoding, or a different one? Is the page response being decoded with the proper encoding? What language was the library written in? There are a number of possibilities there.
aperkins
+1  A: 

aperkins gave a good suggestion. Note that depending on your IDE, you may need to set the your editor to UTF-8 and set the java compiler option -encoding utf-8

Joao
@Joao, thanks for the suggestion, I just did that!
goutham