Ignore:
Timestamp:
09/01/09 14:59:15 (15 years ago)
Author:
niltonneto
Message:

Ticket #528 - Adição de novo método para correção desse ticket.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/inc/class.functions.inc.php

    r1059 r1384  
    11<?php 
    22        class Functions{ 
    3                  
    4                  
    53                function CallVoipConnect($params){ 
    64                        $fromNumber = $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['telephone_number']; 
     
    112110                        return $_SESSION['phpgw_info']['user']['preferences']['expressoMail']; 
    113111                } 
    114         } 
     112                // Unicode Conversor: convert everything from UTF-8 into an NCR[Numeric Character Reference] 
     113                function utf8_to_ncr($content)  { 
     114            $result = "";             
     115            while ($strlen = mb_strlen($content)) { 
     116                $c = mb_substr($content, 0, 1, "UTF-8"); 
     117                $h = ord($c{0});    
     118                    if ($h <= 0x7F || $h < 0xC2) { 
     119                        $result .= $c; 
     120                    } 
     121                        else if ($h <= 0xDF) { 
     122                        $h = ($h & 0x1F) << 6 | (ord($c{1}) & 0x3F); 
     123                        $result .= "&#" . $h . ";"; 
     124                    } else if ($h <= 0xEF) { 
     125                        $h = ($h & 0x0F) << 12 | (ord($c{1}) & 0x3F) << 6 | (ord($c{2}) & 0x3F); 
     126                        $result .= "&#" . $h . ";"; 
     127                    } else if ($h <= 0xF4) { 
     128                        $h = ($h & 0x0F) << 18 | (ord($c{1}) & 0x3F) << 12 | (ord($c{2}) & 0x3F) << 6 | (ord($c{3}) & 0x3F); 
     129                        $result .= "&#" . $h . ";"; 
     130                    }                 
     131                $content = mb_substr( $content, 1, $strlen, "UTF-8"); 
     132            } 
     133            return mb_convert_encoding($result,"UTF-8"); 
     134        } 
     135    }    
    115136?> 
Note: See TracChangeset for help on using the changeset viewer.