Jump to content

Paperstyle

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Paperstyle's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. According to the exec() manual page: It's talking about the second parameter to exec().
  2. Are the dimensions of source and destination in the same proportions? By that I mean if you divide source_x by source_y and dest_x by dest_y do you get the same result?
  3. I will use the other method. I just thought there might be a simple explanation of why it wasn't working. Editor: gedit Encoding: UTF-8 Thanks plenty for all your help.
  4. So now I've put the string of 'O's as octal-escaped, like so: function oCodes($string) { // In the above order // \307\252 goes in between \307\221 and \307\254 $codes = "\303\222\303\223\303\224\303\225\303\226\303\227\303\228\303\229\303\230\305\214\305\216\305\220\306\237\306\240\307\221\307\254\307\276\310\214\310\216\310\252\310\254\310\256\310\260\312\230" . /* now begin the 3-octals, with ᴏ */ "\341\264\217\341\264\274\341\271\214\341\271\216\341\271\220\341\271\222\341\273\214\341\273\216\341\273\220\341\273\222\341\273\224\341\273\226\341\273\230\341\273\232\341\273\234\341\273\236\341\273\240\341\273\242"; return preg_replace("/[$codes]/u", 'O', $string); } This returned the following warning: Warning: preg_replace() [function.preg-replace]: Compilation failed: invalid UTF-8 string at offset 14 in /usr/local/www/apache22/data/testformproc.php on line 18
  5. You'd use preg_split, with a pattern something like /\D/ so you're splitting by non-digits. Or if there'll always be underscores separating the numbers you could use explode($yourString, '_').
  6. echo "<br/>The encoding of the posted string is " . mb_detect_encoding($_POST['input'], "auto"); // UTF-8 function matchbox($string) { $string = preg_match('/[ÒÓÔÕÖØŌŎŐƟƠǑǪǬǾȌȎȪȬȮȰᴏᴼṌṎṐṒỌỎỒỔỖỘỚỜỞỠỢ]/u', $string) or print "spungo"; } ... echo "<br/>Testing preg_match: " . matchbox($_POST['input']) . "<br/>"; // nothing printed from the function I just thought then that it could be something about those particular characters, so I tested with some others: echo "<br/>Testing other characters: " . preg_replace('/[ƁƂʙᴃᴮᴯḂḄḆ]/u', 'B', $_POST['input']) . "<br/>"; with the input string being ᴃᴮᴯḂ, and it converted all of them to 'B'. I'll try replacing the original 'O' RegExp with hex-encoded values for the characters instead and post the results of that.
  7. So just so I make sure I've got this right: I can use I18N_UnicodeNormalizer package which will split characters effectively into their component parts, then I use a RegExp to remove the marks, which are in the \p{M} property code? Oh, and I found on this page here http://www.unicode.org/unicode/reports/tr15/ that the NFKD and NFKC will decompose characters like the Æ into A and E (the example is in the introduction and uses the fi ligature character). Thanks a lot for your help. Just as a curiosity, can you see anything wrong with my original RegExp? I really can't understand it. Thanks.
  8. Unfortunately I set the encodings for both pages to be the same: utf-8. On my side there's no caret in the middle of the character class. Are all the characters coming through properly (they're variations on 'O' with different linguistic add-ons)? Maybe they're encoded wrong and that's the problem, though they should be fine because I got them from the character map. I tried putting parentheses in but it didn't work. Thanks for your help, but are there any other ideas?
  9. I'm working on a function to Anglicise a string. Here's part of it in a testing assembly: (apologies for it not being in code tags, but it was converting the characters and making it less readable) <html> <head> <title> splurd </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> </head> <body> <?php function oooo($string) { $string = /*@*/preg_replace('/[ÒÓÔÕÖØŌŎŐƟƠǑǪǬǾȌȎȪȬȮȰᴏᴼṌṎṐṒỌỎỒỔỖỘỚỜỞỠỢ]/u', 'O', $string) or print "pungo"; // nothing prints here } $ooooo = "$_POST[input]"; $ooooo = oooo($ooooo); echo "<h1>$ooooo</h1>"; // nothing inside the header tags echo ord($ooooo); // 0 var_dump($ooooo); // NULL echo str_replace("Ố", "O", "ỐỐ"); // prints "OO" $text="עברית מבולגנת"; function hebrewNotWordEndSwitch ($from, $to, $text) { $text= preg_replace('/'.$from.'([א-ת])/u','$2'.$to.'$1',$text); return $text; } do { $text_before=$text; $text=hebrewNotWordEndSwitch("ך","כ",$text); $text=hebrewNotWordEndSwitch("ם","מ",$text); $text=hebrewNotWordEndSwitch("ן","נ",$text); $text=hebrewNotWordEndSwitch("ף","פ",$text); $text=hebrewNotWordEndSwitch("ץ","צ",$text); } while ( $text_before!=$text ); print $text; // עברית מסודרת! ?> </body> </html> I also got a function from http://au2.php.net/manual/en/function.preg-replace.php to test if it was indeed working (the Hebrew one), and it works. So I send the following string to it: ÒÓÔÕÖ . It returns null. I know that if the pattern is malformed utf-8 the function returns null, but I can't see what's wrong with it. Any help would be very much appreciated. Thanks. EDIT: I'm on FreeBSD 6.1 using PHP 5.2.5 (updated yesterday).
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.