...Unless you plan to support Kanji or Korean these details should not bother you. And if you do, you better use Oracle with UTF-8 instead of MS SQL!
- I'm not aware of any magical printing or Stream settings to minimize coding. This is not to say it does not exist, I just do not know if it does. Within BMPEncode's from_to() with proper error handling was always sufficient for me in the past
undef
I'm not sure about Kanji, but I do believe that the site is intended to support Korean...I don't know how much sway I have over the DB decisions, but I'll attempt to find out.Okay - but if I just retrieve the value from the DB query into a variable, and want to make sure it's output as UTF-8 - what would the arguments for from_to() be? Obviously (I hope) the 'to' would be "utf8" - but what do I use for 'from'? Can I assume the 'from' is "ucs-2"? can I specify undef and have it do something magical internally?This is part of what I find so confusing - not really knowing the attributes of the data already stored within a variable and not (as far as I know) having anyway to control that at the "source" when the db query is performed.
FYI - from what I understand - the choice of using MSSQLServer instead of Oracle is because [one of] the consumer of the data in the database is one (or more) .Net application - and they prefer to work with MS...
\>iwperl -MDBD:DBC -le "DBI->installed_versions;" Perl : 5.008002 (MSWin32-x86-multi) OS : MSWin32 (4.0) DBI : 1.38 DBD:ponge : 11.09 DBD:roxy : 0.2004 DBD:DBC : 1.06 DBD::ExampleP : 11.10
select id, dbo.fn_****(title, 65001) from myTable;
(Excluded)
0xE79BB4E98AB7E5...
...my $query = qq(select id, dbo.fn_****(title, 65001) from myTable;my $st = $dbh->prepare($query); # both with, and without 2nd parameter: { odbc_execdirect => 1}$st->execute();...
DBD:DBC::st execute failed: [Microsoft][ODBC SQL Server Driver][SQL Server]Can not find either column "dbo" or the user-defined function or aggregate "dbo.fn_****", or the name is ambiguous. (SQL-42000)
DBD:DBC::st execute failed: [Microsoft][ODBC SQL Server Driver][SQL Server]'fn_****' is not a recognized function name. (SQL-42000)
...This last part isn't quite working right now - but I'm pretty sure there's just a small glitch in my code to account for that - the big thing was getting the connection made to the correct database server and database ;-)
open(OUT, '>:utf8', $file) || die "...";