To save your time, I post an example type handler here:

----------------------------------------------------------------------------------------------------

package org.telluriumsource.ut

import org.telluriumsource.test.ddt.mapping.type.TypeHandler

class PhoneNumberTypeHandler implements TypeHandler{
    protected final static String PHONE_SEPARATOR = "-"
    protected final static int PHONE_LENGTH = 12

    //remove the "-" inside the phone number
    public String valueOf(String s) {
        String value

        if(s != null && (s.length() > 0)){
             value = s.replaceAll(PHONE_SEPARATOR, "")
        }else {
            value = s
        }

        return value
    }


}

On Thu, Aug 5, 2010 at 5:16 PM, Jian Fang <[email protected]> wrote:

> Seems the following code could convert the uicode to a utf-8 string.
>
>    @Test
>     public void testUicode(){
>         String test =
> "\u004E\u00FC\u0068\u0065\u00F0\u0061\u006E\u0020\u03AC\u03C1\u03C7";
>         try {
>             String c = new String(test.getBytes(),"UTF-8");
>             System.out.println("Converted: " + c);
>         } catch (UnsupportedEncodingException e) {
>             e.printStackTrace();
>         }
>     }
>
> For your data driven test, you need to create a custom type handler. Please
> see the example here:
>
>
> http://code.google.com/p/aost/wiki/UserGuide070DetailsOnTellurium#typeHandler
>
> Thanks,
>
> Jian
>
>
> On Thu, Aug 5, 2010 at 4:59 PM, Jian Fang <[email protected]>wrote:
>
>> Seems you need to create a custom handle to convert the unicode to "UTF8"
>> format. I will try to find some time to see if I can create some test code
>> for you.
>> Sorry for that, I am busy with Trump now.
>>
>> Thanks,
>>
>> Jian
>>
>>
>> On Thu, Aug 5, 2010 at 4:11 PM, Jade <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> Some of our test data includes unicode characters, such as:
>>>
>>> enterDocumentInformation|Test Title|My abstract is ... \u004E\u00FC
>>> \u0068\u0065 &|test; Vireo|3|[email protected]|true
>>>
>>> However, the unicode characters aren't being unencoded as they're read
>>> in and bound to the variable.
>>>
>>> String abstractText = bind("DocumentInformationData.abstract")
>>>
>>> println "abstractText: ${abstractText}"
>>>
>>> String test = "\u004E\u00FC\u0068\u0065\u00F0\u0061\u006E\u0020\u03AC
>>> \u03C1\u03C7"
>>> println "test: ${test}"
>>>
>>> abstractText: My abstract is ... \u004E\u00FC\u0068\u0065 &
>>> test: Nüheðan άρχ
>>>
>>> Is there another method that I need to call to unencode the unicode?
>>>
>>> Jade
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "tellurium-users" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected]<tellurium-users%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/tellurium-users?hl=en.
>>>
>>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"tellurium-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/tellurium-users?hl=en.

Reply via email to