Ant build not able to recognize spanish characters

Tag: apache , ant , selenium Author: betong Date: 2012-09-01

I am having a Selenium project that uses Apache ANT to execute the tests.

In a certain scenario i need to validate a few Spanish texts like "eBay España" i.e. text with accented characters.

When i execute the test normally from my IntelliJ IDEA IDE it runs properly and validates the Spanish characters appropriately.

But when i try executing the test from Apache ANT console in the IDE , it is not able to recognize the Spanish accented characters.

Check O/P

  • Normal Execution -

    INFO [main] (VerifySpanishCharacters.java:45) - FIRE FOX DRIVER INSTANTIATED INFO [main] (VerifySpanishCharacters.java:46) - SELENIUM DRIVER INSTANTIATED INFO [main] (VerifySpanishCharacters.java:47) - https://login.salesforce.com/ [email protected]9b290 eBay España áéíóú INFO [main] (VerifySpanishCharacters.java:61) - selenium driver closed

  • Apache ANT Execution

    MESSAGE LOGGED [testng] INFO [pool-2-thread-1] (VerifySpanishCharacters.java:45) - FIRE FOX DRIVER INSTANTIATED MESSAGE LOGGED [testng] INFO [pool-2-thread-1] (VerifySpanishCharacters.java:46) - SELENIUM DRIVER INSTANTIATED MESSAGE LOGGED [testng] INFO [pool-2-thread-1] (VerifySpanishCharacters.java:47) - https://login.salesforce.com/ MESSAGE LOGGED [testng] [email protected]c899 MESSAGE LOGGED [testng] eBay Espa MESSAGE LOGGED [testng]  MESSAGE LOGGED [testng] INFO [pool-2-thread-1] (VerifySpanishCharacters.java:61) - selenium driver closed

Can you please help with a possible solution.

Other Answer1

you can use the following link to change the text into UTF8/UTF-16M characters and you can use that characters instead of that text with some escape sequence

http://macchiato.com/unicode/convert.html

Go to this link, in the input box editor give your text, then choose UTF-16M in the dropdown over the output box editor, then click on the button in between input and output box editor, you can get the desired value in the output box editor. you can use the value with the escape sequence in your code.

For example, for the text "eBay España" you will get output as "0065 0042 0061 0079 0020 0045 0073 0070 0061 00F1 0061", you can use this value with escape sequence as "\u0065 \u0042 \u0061 \u0079 \u0020 \u0045 \u0073 \u0070 \u0061 \u00F1 \u0061".

Just try with this...