Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #5179

Re: Random string from selected Unicode character set (test data)

From The Natural Philosopher <tnp@invalid.invalid>
Newsgroups comp.lang.php
Subject Re: Random string from selected Unicode character set (test data)
Date 2012-03-18 00:30 +0000
Organization albasani.net
Message-ID <jk3abd$ejf$1@news.albasani.net> (permalink)
References <1153e411-4007-477a-a6b2-ee421fb4340f@y27g2000yqy.googlegroups.com>

Show all headers | View raw


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.

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Random string from selected Unicode character set (test data) Horst Lemminger <damjensen@gmail.com> - 2012-03-17 12:50 -0700
  Re: Random string from selected Unicode character set (test data) The Natural Philosopher <tnp@invalid.invalid> - 2012-03-18 00:30 +0000
  Re: Random string from selected Unicode character set (test data) gordonb.9boif@burditt.org (Gordon Burditt) - 2012-03-23 00:36 -0500

csiph-web