28, May 2012

A way around iconv - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: A way around iconv
« previous next »
Pages: [1] 2 3 Print
Instabuck - The easy way to sell digital products online

Author Topic: A way around iconv  (Read 5728 times)
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1525
6359 credits
Members referred : 8


Gimme all your cookies!!!


« on: Jul 20, 2006, 07:16:45 am »

Including iconv into php seems to be breaking my server. I was wondering there was another way to use this function.


Last blog : Canonical URL Links / Tags
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Jul 20, 2006, 09:33:42 am »

Including iconv into php seems to be breaking my server. I was wondering there was another way to use this function.
for what purpose you want to use iconv?

Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1525
6359 credits
Members referred : 8


Gimme all your cookies!!!


« Reply #2 on: Jul 20, 2006, 09:37:16 am »

Well, it is for that Chinese pdf stamp... I was looking into changing the mysql encoding as an alternative, as I will be storing the Chinese on the server and then it will be the source for the stamper.


Last blog : Canonical URL Links / Tags
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Jul 20, 2006, 09:47:40 am »

is this data stored witch utf-8 encoding?

Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1525
6359 credits
Members referred : 8


Gimme all your cookies!!!


« Reply #4 on: Jul 20, 2006, 10:00:09 am »

I would say so... I was trying to use this function:

Code:
<?php
   iconv
("ucs-2","GB2312",hex2bin(base_convert(substr($str,2,5), 1016)));
?>


But iconv seems to be out of the question for me now...


Last blog : Canonical URL Links / Tags
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #5 on: Jul 20, 2006, 10:22:35 am »

but why do you need to convert the characters?
you can show them with utf-8 or not?

I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #6 on: Jul 20, 2006, 10:25:22 am »

Check first the alternative functions here.

The ivonv extension needs to be compiled with php, so if you just add the .so (or .dll) file it wont work anyway.

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1525
6359 credits
Members referred : 8


Gimme all your cookies!!!


« Reply #7 on: Jul 20, 2006, 10:37:29 am »

There are no alternative functions really. I have tried libiconv too but it is not included in the php. We tried compiling it with php but it brought down every site on the server... not good!

I was wondering if there was another way around this.

the Chinese characters are stored like this ...

Code:
  // & # 33756; & # 33756;  <- without the spaces

and they need to look like this ...

Code:
  // ' ²{? &#201; ? &#240;· &#197; 18 C &#192;&#227;«&#215; 83 %'
« Last Edit: Jul 20, 2006, 10:40:24 am by wineo »


Last blog : Canonical URL Links / Tags
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #8 on: Jul 20, 2006, 10:43:40 am »

BTW do you have support for chinese in the machine you are testing?

It is a dump question, but some times the problem is that easy....

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1525
6359 credits
Members referred : 8


Gimme all your cookies!!!


« Reply #9 on: Jul 20, 2006, 10:50:55 am »

My laptop sees the Chinese characters no problem and they are stored in mysql db no problem. It is just the pdf stamp that requires the characters in GB2312 encoding.

Maybe I just need to sort out this issue with getting iconv to work!?


Last blog : Canonical URL Links / Tags
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #10 on: Jul 20, 2006, 10:58:15 am »

Quote
Maybe I just need to sort out this issue with getting iconv to work!?

That would be the best way, but as it going to take you some time, I suggest to see what happens if you change the mysql encoding

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #11 on: Jul 20, 2006, 11:12:41 am »

Quote
It is just the pdf stamp that requires the characters in GB2312 encoding.
does this pdf tool not work for you with utf-8 encoding?

Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1525
6359 credits
Members referred : 8


Gimme all your cookies!!!


« Reply #12 on: Jul 20, 2006, 11:48:45 am »

Yeah the stamp works, but for Chinese I need to convert the encoding...

The language of the db is English-iso-8851-1. What would happen if I changed it to Traditional Chinese Big5? Would it affect all the data that iis in there OR all the data that is stored after the change?


Last blog : Canonical URL Links / Tags
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #13 on: Jul 20, 2006, 11:59:07 am »

I guess the only way to find out is to do it Smiley

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #14 on: Jul 20, 2006, 02:02:59 pm »

Yeah the stamp works, but for Chinese I need to convert the encoding...

The language of the db is English-iso-8851-1. What would happen if I changed it to Traditional Chinese Big5? Would it affect all the data that iis in there OR all the data that is stored after the change?
so you have a mix of iso-8859-1 and chinese?

Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1525
6359 credits
Members referred : 8


Gimme all your cookies!!!


« Reply #15 on: Jul 20, 2006, 02:18:45 pm »

True and the Chinese looks like the above example (one without the spaces).

We are going to try again on the weekend to update php to include iconv. So I will keep you posted! Thanks for the help guys!


Last blog : Canonical URL Links / Tags
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #16 on: Jul 20, 2006, 02:21:25 pm »

True and the Chinese looks like the above example (one without the spaces).

We are going to try again on the weekend to update php to include iconv. So I will keep you posted! Thanks for the help guys!

Good luck with the recompilation man Smiley

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1525
6359 credits
Members referred : 8


Gimme all your cookies!!!


« Reply #17 on: Aug 01, 2006, 05:52:41 pm »

The recompilation now has iconv in it, but I still seem to be battling with the results! Why is this not working???

Code:
<?php

$pdf 
= new PDF_Chinese();
$pdf->AddBig5Font();
$pdf->Open();
$pdf->AddPage();
$pdf->SetFont('Big5','',20);

$str '& # 33756;';   // <- no spaces
$tmp substr($str,2,5);
$tmp2 base_convert($tmp102);
$tmp3 iconv("latin1","GB2312"$tmp2);
$tmp4 iconv("latin1","BIG5"$tmp2);

$pdf->Write(10,"str : $str
tmp : '.
$tmp.'
tmp2: '.
$tmp2.'
tmp3: '.
$tmp3.'
tmp4: '.
$tmp4");

$pdf->Output();
?>


And here is my result:

str : & # 33756;  <- no spaces
tmp : 33756
tmp2: 33756
tmp3: 1000001111011100
tmp4: 1000001111011100


Last blog : Canonical URL Links / Tags
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #18 on: Aug 02, 2006, 10:42:06 am »

What if you replace the & # with &

I know this is not the solution you are looking for, but propably it will work...

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1525
6359 credits
Members referred : 8


Gimme all your cookies!!!


« Reply #19 on: Aug 02, 2006, 10:45:51 am »

Well the line...

Code:
<?php
$tmp 
substr($str,2,5);
?>


removes the & # from the line anyway.


Last blog : Canonical URL Links / Tags
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=3341
Tags : php html mysql databases email Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] 2 3 Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: A way around iconv
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 12:23:02 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.