Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jul 2006
    Posts
    96
    Thanks
    3
    Thanked 0 Times in 0 Posts

    writes to files as

    Hi all

    I am writing a simple text file with php and have run into a small prob. when writing the string:

    $write_me = "ne Smith";

    the output text file is written as :

    ne Smith

    Any ideas why this would capitalise and how to get round it.

    Cheers
    Steve

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by Cacus View Post
    Hi all

    I am writing a simple text file with php and have run into a small prob. when writing the string:

    $write_me = "ne Smith";

    the output text file is written as :

    ne Smith

    Any ideas why this would capitalise and how to get round it.

    Cheers
    Steve
    probably you use utf-8 for output and this is iso-8859-1. Try to change encoding.

    regards

  • #3
    New Coder
    Join Date
    Jul 2006
    Posts
    96
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Hi thanks for the reply.

    How do you change the encoding in php. I'm simply using the write function to save the string to a file.

    Cheers

  • #4
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by Cacus View Post
    Hi thanks for the reply.

    How do you change the encoding in php. I'm simply using the write function to save the string to a file.

    Cheers
    PHP Code:
    <?php

    $write_me 
    "ne Smith";
    echo 
    mb_convert_encoding($write_me"iso-8859-1""utf-8");
    echo 
    $write_me."\n";

    ?>
    Edit: I was wrong in my previous post, you use utf-8 and output is something else. mb_convert_encoding will fix this.



    regards
    Last edited by oesxyl; 12-02-2008 at 08:22 PM.

  • #5
    New Coder
    Join Date
    Jul 2006
    Posts
    96
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Cheers will give it a go today.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •