Jump to content

eyrique

Members
  • Posts

    12
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

eyrique's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. The string might contain combination of chinese & english words, or just a single language. Eg: 祝你生日快樂 (6 words) 祝你 Happy Birthday (4 words) Happy Birthday (2 words)
  2. Technically this string should be considered as 6 character instead of 6 words, but the Chinese don't count it that way. I'd tried mb_strlen() but that work for English words as this function is calculating the characters. Here's what we are looking for: 祝你生日快樂 - 6 words Happy Birthday - 2 words
  3. I check on my server $ pcretest -C and got this following output: PCRE version 6.6 06-Feb-2006 Compiled with UTF-8 support Unicode properties support Newline character is LF Internal link size = 2 POSIX malloc threshold = 10 Default match limit = 10000000 Default recursion depth limit = 10000000 Match recursion uses stack I suppose this is unicode-properties enabled?
  4. Hi, I had written a function to calculate total words in a string. For example: 祝你 Happy Birthday - considered as 4 words 祝你生日快樂 - considered as 6 words Happy Birthday 帥哥 2013 - considered as 5 words Happy Birthday 09/09/13 - considered as 3 words The problem is that I'd tested it on localhost (using AppServ Windows 7) and it works perfectly. But when I upload it to the server, the chinese words are calculated wrongly, example: 祝你 Happy Birthday - become as 3 words 祝你生日快樂 - become as 1 word Happy Birthday 帥哥 2013 - become as 4 words Not sure what's wrong with it. Can someone help on this? Here's my code: function count_total_word($txt){ $total = count(preg_split('~[\p{Z}\p{P}]+~u', $txt, null, PREG_SPLIT_NO_EMPTY)) + 1; // Count Words $total -= count(preg_split('~[/]+~u', $txt, null, PREG_SPLIT_NO_EMPTY)); // Ignore "/" return $total; } Localhost PHP: 5.2.6 Server PHP: 5.2.17 Thanks
  5. anymore suggestion? thanks ~
  6. or any suggestion what to look for? i really have no idea
  7. 3gp is a video format file... i dun think it is possible to use the image resizing function for this case...
  8. hi, is there a way to cut uploaded 3gp file into smaller size? let's say user upload a 300kb file, and i would make all the 3gp at a maximum of 200kb file size. So the additional 100kb will be removed. Means tht when user see the video, it has only 2/3 of the original length. thanks
  9. hi, my application is to receive an xml posted by others, for example: $xml = "<?xml version='1.0' encoding='utf-8'?> <address> <street>Lot 11, Happy Street</street> <state>Florida</state> <country>USA</country> </address> "; $ch = curl_init("http://localhost/address/index.php"); curl_setopt($ch, CURLOPT_TIMEOUT, 20); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, array( 'xml' => $xml, )); $response = curl_exec($ch); curl_close($ch); and i received it to process. so i use $xml_array = simplexml_load_string($_POST['xml']); but the problem is it shows this errors: Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : String not started expecting ' or " in C:\AppSer\process.php on line 14 Warning: simplexml_load_string() [function.simplexml-load-string]: <?xml version=\"1.0\" encoding=\"utf-8\"?> in C:\AppSer\process.php on line 14 Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in C:\AppSer\.php on line 14 Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Malformed declaration expecting version in C:\AppSer\.php on line 14 Warning: simplexml_load_string() [function.simplexml-load-string]: <?xml version=\"1.0\" encoding=\"utf-8\"?> in C:\AppSer\process.php on line 14 Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in C:\AppSer\process.php on line 14 Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Blank needed here in C:\AppSer\process.php on line 14 Warning: simplexml_load_string() [function.simplexml-load-string]: <?xml version=\"1.0\" encoding=\"utf-8\"?> in C:\AppSer\process.php on line 14 Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in C:\AppSer\process.php on line 14 Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : parsing XML declaration: '?>' expected in C:\AppSer\process.php on line 14 Warning: simplexml_load_string() [function.simplexml-load-string]: <?xml version=\"1.0\" encoding=\"utf-8\"?> in C:\AppSer\process.php on line 14 Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in C:\AppSer\process.php on line 14 but then i tried to print_r($_POST['xml']) and i got this result: <?xml version=\'1.0\' encoding=\'utf-8\'?> <address> <street>Lot 11, Happy Street</street> <state>Florida</state> <country>USA</country> </address> if seems like the server automatically convert the '1.0' into \'1.0\' is this the cause that make the simplexml_load_string function work wrongly? is there any way to solve this? thanks alot
×
×
  • 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.