Re: Random string from selected Unicode character set (test data) [message #177361 is a reply to message #177359] |
Sun, 18 March 2012 00:30 |
The Natural Philosoph
Messages: 993 Registered: September 2010
Karma:
|
Senior Member |
|
|
Horst Lemminger wrote:
> I am implementing the script from generatedata.com
>
> But I would like for it to also display Unicode chars, so I can test
> other languages.
>
> I have looked everywhere, but can't seem to find a PHP function that
> lets me do something like
>
> $outstring .= $make_unicode_random('katakana');
>
> thereby selecting things from the code points U+30A0 .. U+30FF
>
> etc
>
I would simply make an indexed array of all the characters you want to
select from, and then randmonly index into that.
I've done similar in the past by writing a program to write the source
code of a large lookup table.
Sometimes the 'table' approach is just simpler (and much faster) than an
algorithmic approach unless you are REALLY strapped for code/static
memory..
Which is unlikely to be the case with a typical LAMP type installation.
> The strings could be defined more broadly like "japanese" etc for
> language separation. Not important.
>
use separate tables for each character set..
> Point is to get a string of 1..n chars of a certain language group, be
> it Greek, European accents, Japanese, Mandarin, Hangul etc
>
> I have found a project "babel" which is a .NET application. Not sure
> if it's open sourced.
>
> Anyone have some pointers to this project ?
>
Not me
--
To people who know nothing, anything is possible.
To people who know too much, it is a sad fact
that they know how little is really possible -
and how hard it is to achieve it.
|
|
|