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
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
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: