Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8011431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:00:52+00:00 2026-06-04T19:00:52+00:00

Dear stackoverflow users, I’m currently working on a schoolproject which involves generating a PHP

  • 0

Dear stackoverflow users,

I’m currently working on a schoolproject which involves generating a PHP webapplication from an existing MSSQL database by using its meta data. I currently have a problem with saving a varchar or a nvarchar datatype to the harddisk. I found several stored procedures on the internet which all use the so_OAMethod to save a string to the harddisk. These stored procedures all work. My problem is that they save the files using UTF-16 character encoding. We have to use an apache webserver with the standard PHP module. The problem with this is that PHP interpreter interprets the UTF-16 file wrong, we do get normal webpages with the PHP code as normal text. My question is there a way to way to save a file from Microsoft SQL Server to the harddisk in UTF-8 format? Or is there a possibility to get the PHP interpeter to interpret the UTF-16 file as normal PHP code?

Kind regards,
Wouter

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:00:53+00:00Added an answer on June 4, 2026 at 7:00 pm

    I assume you’ll call something like CreateTextFile in your stored procedure to write the data out, since it seems that these stored procedures call vbscript. Such routines usually have a means to specify wether you want unicode or ansi.

    so you’ll get something like

    sp_OAMethod @objFileSystem , 'CreateTextFile' , @objTextStream OUT, @FileAndPath,2,True
    

    so Scripting.FileSystemObject instance, text to save, Path to your files, overwrite?,ANSI/UNICODE (False = ANSI, True = unicode)

    Normally if you’d use this method it should automatically create an ANSI file.

    for reference:

    Sub CreateAfile
        Set fs = CreateObject("Scripting.FileSystemObject")
        Set a = fs.CreateTextFile("c:\testfile.txt", True)
        a.WriteLine("This is a test.")
        a.Close
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hallo Dear Stackoverflow users. Working with sql on sql server I have searched the
Dear Friends from Stackoverflow, Please help me with a problem that i'm having when
Dear fellow readers on Stack Overflow, I am currently working in CSS and I
Dear stackoveflow, I have this problem. I'm working with an old version of mssql
Hello dear users of the stackoverflow! I really like the search form on this
good day dear php-fans at stackoverflow. i want to use imagegrabscreen — to get
Dear honorable people of stackoverflow, why is my textbox, which is my validated control,
Dear all, I have a data frame which comes directly from a sensor. The
Dear StackOverflow users, I found a of information about what Drawables to use (HDPI,
Dear stackoverflow members, I have a small problem, I want to replace some characters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.