Help - Search - Member List - Calendar
Full Version: read file .udl
WorkTheWeb Forums > Webmaster Resources > PHP Help
Support our Sponsors!
*Davide*
Hi to all,
I must read and work with a .udl file (this is unicode)
And so I use the istruction $array = file($path_udl), but:
$array[1] = P r o v i d e r = S Q L O L E D B . 1 ; P a s s w o r d = R a
d 1 s h ;
With the "space" from char to char, if I open the file in binary mode from
chat to char there is a 00 (NULL)
I use the function mb_*, but nothing change, also the mb_ereg_replace.

I tried this istructions, but nothing change!
$utf_content = file_get_contents ('file.udl');
$decoded_content = utf8_decode ($utf_content);
$array = explode ("rn", $decoded_content);

Thanks in advantage!
*Davide*

Hilarion
QUOTE
I must read and work with a .udl file (this is unicode)
And so I use the istruction $array = file($path_udl), but:
$array[1]  =  P r o v i d e r = S Q L O L E D B . 1 ; P a s s w o r d = R a
d 1 s h ;
With the "space" from char to char, if I open the file in binary mode from
chat to char there is a 00 (NULL)
I use the function mb_*, but nothing change, also the mb_ereg_replace.

I tried this istructions, but nothing change!
$utf_content = file_get_contents ('file.udl');
$decoded_content = utf8_decode ($utf_content);
$array = explode ("rn", $decoded_content);


Which "mb_*" function did you use?
Try this (utf8_decode is for UTF-8, not for Unicode):

<?php
$unicode_content = file_get_contents ('file.udl');
$decoded_content = mb_convert_encoding( $unicode_content, "ASCII", "UCS-2" );
$array = explode ("rn", $decoded_content);
?>

You should replace "ASCII" with the charset you are using on your webpage.

Hilarion

*Davide*
Hilarion wrote:
QUOTE
I must read and work with a .udl file (this is unicode)
And so I use the istruction $array = file($path_udl), but:
$array[1]  =  P r o v i d e r = S Q L O L E D B . 1 ; P a s s w o r
d = R a d 1 s h ;
With the "space" from char to char, if I open the file in binary
mode from chat to char there is a 00 (NULL)
I use the function mb_*, but nothing change, also the
mb_ereg_replace.

I tried this istructions, but nothing change!
$utf_content = file_get_contents ('file.udl');
$decoded_content = utf8_decode ($utf_content);
$array = explode ("rn", $decoded_content);


Which "mb_*" function did you use?
Try this (utf8_decode is for UTF-8, not for Unicode):

<?php
$unicode_content = file_get_contents ('file.udl');
$decoded_content = mb_convert_encoding( $unicode_content, "ASCII",
"UCS-2" ); $array = explode ("rn", $decoded_content);


You should replace "ASCII" with the charset you are using on your
webpage.

Hilarion

Hi Hilarion,
Great Hilarion!
The script runs correctly!


PHP Help | Linux Help | Web Hosting | Reseller Hosting | SSL Hosting
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2006 Invision Power Services, Inc.