selenium - PHP stripping letters with accents/weird letters and changing them by normal letters -


I am using PHPunit Selenium WebDriver from Sebastian Bergmann.

So what I am doing basically is:

I get a random name of the random name generator and I get it for example: Josh Parker < / Em>

I blast them in the first and last names

  $ fullname = explosion ('', $ thename); $ Firstname = $ fullname [count ($ fullname) -1]; $ Lastname = $ fullname [count ($ fullname) -2]; // I should name the name and weird letters  

By using this name I create an email to fill out a form. The email will be: josh.parker@ourdomain.com

The issue is that the fields do not accept any accents or strange letters on letters like ä ö ô è é ù etc. ... so if I get a random name: Rage Olivier

When I put it in an email

  $ domain = ' @ Domain.be '; $ Array5 = array ($ firstname, $ lastname); $ Fullname uuser = intestine ("-", $ array5); $ Array7 = array ($ full nameserver, $ domain); $ Genemail = implode ("", $ array7);  

The result will be: Olivier.Régis@domain.be will not accept this name because of its code in this user's field.

Anyway, can I check letters with Accent and can I convert them to the general letter? I am not sure about all the letters, I had problems with the letter Æ and ç aswell.

é, è -> e

ç -> c

Æ - >

>

one -> one

ATC ...

Accent Stripping is not easy because at least my knowledge) solution prepared in PHP.

A classic solution will look like this:

  function removeAccents (str) {var find, re; Var a = ['À', 'A', 'A', 'A', 'A', 'A', 'AI', 'C', 'È', 'A', 'Ê', 'Ë ',' Ì ',' Í ',' Î ',' Ï ',' Ð ',' Ñ ',' Ò ',' ',' ',' Ô ',' Õ ',' o ',' Ø 'A', '' '', '', '', '', '' '' '', '', '', '', '', '', '', '', '', '', '', '' , '', '' ',' ',' ',' ',' ',' ',' '', 'Me', '' '' '' '' '', 'ò' 'O', 'O', 'õ', 'O', 'O', 'You', 'You', 'You', 'You', '¨', 'ÿ', 'Ā', 'A ',' Ă ',' â ',' Ć ',' ć ',' Ĉ ',' ĉ ',' Ċ ',' ċ ',' Č ',' č ',' Ă ',' Ă ',' 'Ď', 'Ď', 'đ', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě' ',' E ',' Ĝ ',' ĝ ',' Ğ ',' ğ ',' Ġ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'A', 'A', 'A', 'A', 'O', 'O', 'O', 'O', 'O', 'You', 'You', 'You', 'You', 'Y', 'Y' A, A, A, C, C, C, C, C, C, C, C, D, D 'D', 'D', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E' 'Ji', 'ji', 'ji', 'ji', 'ji', 'ji', 'g', 'h', 'h', 'h', 'h', 'i', 'i' , 'I', 'I', 'I', 'I', 'I', 'I', 'I', 'I', 'IJ', 'Eyes',' J. 'L', 'L', 'L', 'L', 'L', 'J', 'K', 'K', 'L', 'L', 'L', 'L', 'L '' L ',' N ',' N ',' N ',' N ',' N ',' N ',' N ',' O ',' O ',' O ',' O, O, O, O, O, R, R, R, R, R, R, S, S , 'S', 's',' s', 's',' s', 't', 't', 't', 't', 't', 't', 'u 'U', 'you', 'you', 'you', 'you', 'you', 'you', 'you', 'you', 'you', 'you', 'w' 'W', 'Y', 'Y', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'S', 'F', 'O' , 'O', 'You', 'You', 'A', 'A', 'I', 'I', 'O', 'O', 'You', 'You', 'You', 'U ',' You ',' you ',' you ',' you ',' you ',' you ' , 'A', 'A', 'A', 'A', 'O', 'O', 'A', 'α', 'Ε', 'ε', 'Ο', 'ο', ' Ω ',' ω ',' Ι ',' ι ',' ι ',' Ι ',' Υ ',' υ ',' υ ',' υ ',' Η ',' η ']; (Var i = 0; i & lt; a.length; i ++) for {find = 'abc'; Re: new = RegExp (a [i], 'g'); Str = str.replace (again, b [i]); } Return str; }  

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -