ThaiSEOBoard.com

พัฒนาเว็บไซต์ => Programming => ข้อความที่เริ่มโดย: jaja ที่ 05 เมษายน 2007, 23:31:00



หัวข้อ: iconv()
เริ่มหัวข้อโดย: jaja ที่ 05 เมษายน 2007, 23:31:00
ตอนผมลง Script ตัวนึง (rss feed) มันขึ้นมาว่าอย่างเนี้ยครับ

Fatal error: Call to undefined function: iconv() in.............

มันคืออะไรเหรอครับ


หัวข้อ: iconv()
เริ่มหัวข้อโดย: kahn ที่ 06 เมษายน 2007, 01:54:24
ไม่มี function iconv(); อยู่ไงครับ  :D
อาจจะขาดบางไฟล์ไปนะครับ ลองหาดู


หัวข้อ: iconv()
เริ่มหัวข้อโดย: Tee++; ที่ 06 เมษายน 2007, 03:43:50
iconv คงโดน Host ปิดอยู่ ลองติดต่อไปที่ hosting สิครับ บางแห่งก็ไม่ยอมเปิดตัวนี้ให้


หัวข้อ: iconv()
เริ่มหัวข้อโดย: jaja ที่ 06 เมษายน 2007, 11:39:16
มันเกียวกับอะไรเหรอครับ


หัวข้อ: iconv()
เริ่มหัวข้อโดย: Pipo ที่ 07 เมษายน 2007, 05:33:46
อ้างจาก: "jaja"
มันเกียวกับอะไรเหรอครับ


เป็น Extension ของ PHP ครับ
เอาไว้แปลง Charactor ไปมา เช่น TIS-620 ไปเป็น UTF-8



This module contains an interface to iconv character set conversion facility. With this module, you can turn a string represented by a local character set into the one represented by another character set, which may be the Unicode character set. Supported character sets depend on the iconv implementation of your system. Note that the iconv function on some systems may not work as you expect. In such case, it'd be a good idea to install the GNU libiconv library. It will most likely end up with more consistent results.


หัวข้อ: iconv()
เริ่มหัวข้อโดย: kahn ที่ 07 เมษายน 2007, 05:58:16
ผมไม่เคยใช้มันเลยอ่า ไม่รู้ด้วยซ้ำว่ามีให้ใช้  :lol:


หัวข้อ: iconv()
เริ่มหัวข้อโดย: jaja ที่ 07 เมษายน 2007, 10:48:55
ถ้า โฮสมันไม่ Support จริงๆ

เราลบมันทิ้งได้เป่าครับโคดมันเป็นอย่างงี้อะ (ย่อมาครับ)

***************************************
// if there is some result... process it and return it
      if(isset($out[1])) {
         // Process CDATA (if present)
         if ($this->CDATA == 'content') { // Get CDATA content (without CDATA tag)
            $out[1] = strtr($out[1], array('<![CDATA['=>'', ']]>'=>''));
         } elseif ($this->CDATA == 'strip') { // Strip CDATA
            $out[1] = strtr($out[1], array('<![CDATA['=>'', ']]>'=>''));
         }

         // If code page is set convert character encoding to required
         if ($this->cp != '')
            //$out[1] = $this->MyConvertEncoding($this->rsscp, $this->cp, $out[1]);
            $out[1] = iconv($this->rsscp, $this->cp.'//TRANSLIT', $out[1]);
         // Return result
         return trim($out[1]);
      } else {
      // if there is NO result, return empty string
         return '';
      }
   }
***************************************

ผมไม่ค่อยรู้เรื่อง PHP หนะครับ  

 :cry:


หัวข้อ: iconv()
เริ่มหัวข้อโดย: Pipo ที่ 07 เมษายน 2007, 12:33:11
ผมว่าลองแก้จาก
โค๊ด:

//$out[1] = $this->MyConvertEncoding($this->rsscp, $this->cp, $out[1]);
$out[1] = iconv($this->rsscp, $this->cp.'//TRANSLIT', $out[1]);


แก้เป็น
โค๊ด:

$out[1] = $this->MyConvertEncoding($this->rsscp, $this->cp, $out[1]);
//$out[1] = iconv($this->rsscp, $this->cp.'//TRANSLIT', $out[1]);


เหมือนว่าคนเขียนทำ Function ไว้เองกรณีไม่มี iconv อยู่แล้ว
หรือถ้ามันไม่ได้จริงก็ลอง ใส่ Comment มันให้หมดจะได้ไม่ต้องแปลง
โค๊ด:

//$out[1] = $this->MyConvertEncoding($this->rsscp, $this->cp, $out[1]);
//$out[1] = iconv($this->rsscp, $this->cp.'//TRANSLIT', $out[1]);


หัวข้อ: iconv()
เริ่มหัวข้อโดย: jaja ที่ 07 เมษายน 2007, 14:03:25
ได้แล้วครับ ขอบคุณมากๆๆๆๆๆ  เลยครับ

ลองแก้มันเป็นแบบนี้ครับ

โค๊ด:

//$out[1] = $this->MyConvertEncoding($this->rsscp, $this->cp, $out[1]);
//$out[1] = iconv($this->rsscp, $this->cp.'//TRANSLIT', $out[1]);


มันเป็นสคิบของ late rss หนะครับ

โค๊ด:
http://lastrss.oslab.net/


เอามา จาก thaisarn.com หนะครับ

ขอบคุณอีกทีครับ