473,404 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

fopen GB2312 encoding problem

Hi,

I am trying to read in a url which is encoded in GB2312 (http://
top.baidu.com/winkvane.html). I have tried other pages with this
encoding and each time I get a connection time out error. It seems
that fopen cannot open a webpage in GB2312. Is there a way around
this? Has anyone else had this sort of problem?

Here is an example with some simple code (using PHP5):

$file = fopen("http://top.baidu.com/winkvane.html", "r") or
exit("Unable to open file!");

while(!feof($file))
{
echo fgets($file). "<br />";
}
fclose($file);

Any ideas would be greatly appreciated! Thank you.
Sadie

Jun 25 '07 #1
0 2070

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: terence.parker | last post by:
I have language text stored as variables in text files, which are 'included' by my PHP scripts (is there a better way?). However, I seem to have a problem with the simplified chinese GB2312...
4
by: steven | last post by:
When I specify an source encoding such as: # -*- coding: GBK -*- or # -*- coding: GB2312 -*- as the first line of source, I got the following error: SyntaxError: 'unknown encoding: GBK'
7
by: git_cs | last post by:
Hey, guys and gals Somedays ago, I had asked for the DES algorithm in C language. Although I have written the algorthim in C myself, I am facing a peculiar problem, which I hope some of u guys and...
3
by: Patrice | last post by:
Hi, I would to call fopen function several time in my application. This application permits to read files which path is registered in a configuration file. For exemple: File 1 = toto.txt File 2...
10
by: pjlsr | last post by:
It's close to twenty years since I used the C language and at that time I was doing only floating point computational work, nothing with strings or reading files. I tried to use fopen in the...
7
by: wood0000 | last post by:
Hi, I know the code of a character is -12590, do you know how to convert to the character in ASP (It is a Chinese character in gb2312 format)? Or, do you know how to convert this -12590 to its...
20
by: David Mathog | last post by:
A program of mine writes to a tape unit. Output can be either through stdout or through a file opened with fopen(). When all the data is transferred to tape the program needs to close the output...
1
by: peterjo | last post by:
Hi All, We have a file thats contain english and chinese data(in GB2312 format). I need to convert chinese GB2312 data into BIG5 format. Could someone please let me know, how can we do it...
16
by: Hans Fredrik Nordhaug | last post by:
I'm trying to write to a file in the current directory - no remote files. The subject says it all - I can add that both the directory and the file is wordwritable. This happens on a (quite good)...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.