Member Avatar

The following code produces the XML file that I am after. $dom = new DOMDocument('1.0', 'UTF-8'); // pretty formatting $dom->formatOutput = true; // create root element $root = $dom->createElement('Poem'); $root->setAttribute('object_id', '542'); $dom->appendChild($root); // create title element $title = $dom->createElement('title'); $root->appendChild($title); // create a node for the title element $text = $dom->createTextNode('The Unknown Poem'); $title->appendChild($text); // save xml as string $test = $dom->saveXML(); echo($test); $dom->save('testDOM.xml'); I get `testDom.xml` contaning the details that I need. However, the `echo($test);` prints nothing. What might be the cause I wonder? I tried `print_r()` too. Any suggestions? ## Additional Information ## XAMPP (on Win 8) is …

Member Avatar
0
31
Member Avatar

I just thought I'd share this because it took me a bit of time to figure out tonight. When members post content with MS Word quotes, etc., and they look funky on our UTF-8 websites, it's because those characters need to be converted to UTF-8. This bit of code worked for me so I thought I'd share. // Convert ISO-8559-1 characters (and MS Word characters) to UTF8 $string = iconv('UTF-8', 'ISO-8859-1//TRANSLIT', $string); // Run htmlspecialchars accepting UTF-8 characters (on older versions of PHP) return htmlspecialchars($var, ENT_COMPAT, 'UTF-8');

Member Avatar
2
18
Member Avatar

Working with Microsoft Visual Studio 2010 Professional, using C#, with Microsoft SQL Server 2008. I have been tasked with taking an existing application, and making changes so that it can receive multiple languages in its text boxes without needing to configure ahead of time what language is to be used. To ensure that I am doing this correctly, I have created a new table in the database, called Language. If I can get things working correctly with [Language], I should be able to get it all working. The field in question is "MotherTongueLanguageName": CREATE TABLE [Language]( [LanguageID] [tinyint] IDENTITY(1,1) NOT …

Member Avatar
0
38
Member Avatar

Hello, I'm having some trouble with a £ sign, it's being displayed to the user as the <?> question-mark-in-a-black-diamond icon. I have an SQL Server database with a £ in a table. (Collation Latin_General_C1_AS which is analoguous to 8859-1) I have a PHP script which retreives this record without issue and can display it on a web page OK. This is with the PHP script file's encoding set to UTF-8 without BOM. The issue appears to be displaying the page in an AJAX request. var http = new XMLHttpRequest; ... document.getElementById('myDivElement').innerHTML = http.responseText; http.responseText appears to be treating the results …

Member Avatar
0
13
Member Avatar

Hi, I have problems with getting data out of the **MS SQL Server 7.0** database in right encoding using **odbc** connection: $conn = odbc_connect("Driver={SQL Server};Server=$server;Database=$database; CharacterSet => UTF-8", $user, $password); I had the same problem when I used MS SQL Server 2005 and sqlsrv connection, but I found the solution. *'CharacterSet' => 'UTF-8'* did the work and everything was fine in above connection it changes nothing: $connectionInfo = array("Database" => ini_get("odbc.default_db"), "UID" => ini_get("odbc.default_user"), "PWD" => ini_get("odbc.default_pw"), 'CharacterSet' => 'UTF-8'); $conn = sqlsrv_connect($serverName, $connectionInfo); I am stuck for 2 days now and desperate, i have looked all over google, php …

Member Avatar
0
19
Member Avatar

Hi, I have an application that converts the ascii characters within the excel file into hexa conversion ie. à to & #x00E0; but my application has one strict requirement and that is the excel file must be properly encoded in UTF-8. I have noticed that simply saving the excel file in windows will have CP1251 encoding causing some characters to be unreadable in python. So, the work around is open the excel file in OpenOffice Scal and save it as .csv, edit the setting and set to UTF-8 and save again as .xls. Problem is, i need to make sure …

0
1
Member Avatar

Dear Friends, I'm having some troubles in my script connected with special characters. I built a program that is supposed to process some images in a folder and give back some files (xls and txt). Everything is fine in most of the cases, but if in the path (including filename) there is any non ascii character such as č I get the following error 'ascii' codec can't encode character u'\u010d' in position...: ordinal not in range(128) How can I handle this problem? Thanks a lot for your help

Member Avatar
0
14
Member Avatar

Greetings! I have a win32 native dll (perhaps that's not the correct term - it's basically a C compiled dll) that I'm accessing in C#. The method signature of the C code (not the actual signature in the dll): [code=C++] char* TestMethod() [/code] I'd like to access the [B]char*[/B] as a [B]byte[][/B] in C#. I know how to access the [B]char*[/B] as a string in C#: [code] [DllImport("DLLTest.dll")] public static extern String ImportedTestMethod(); [/code] The main reason I want to do this is because the [B]char*[/B] output is encoded in UTF-8. If I get the actual bytes in C# then …

Member Avatar
0
4
Member Avatar

Hi guys I used the joomla cms for web development. Actually i install the roknewsrotator module and use it for Persian language that it decode with UTF-8. i don't know why the News rotators module want to show some news in UTF-8 language, at the end of the sentences it showed this icon : � i try to fix it, but until now, i was unsuccessful. I find all of php file of this module and change all of them from ANSI to UTF-8. But the problem persist. If anyone can help me, please guide me. Thank you

Member Avatar
0
10
Member Avatar

Hi i have a lot of ANSI encoded files in the same folder with different extensions and i want to convert all this files into utf-8 encoded files so how can i do this in c# [I][B]Thank you [/B][/I]

Member Avatar
0
2
Member Avatar

hi, i'm using UTF-8 in my database and when i insert unicode characters directly through database it's all fine. But when i'm inserting through an html form using php it sends some kind of other characters to the database e.g : &#3462;&#3514;&#3540;&#3510;&#3549;&#3520;&#3505;&#3530; how can i solve this...???

Member Avatar
0
3
Member Avatar

Hello Experts, Kinda new to perl. I am using perl web API to get the data. The error is "application/xml; charset=UTF-8". I used 'use utf8' but doesn't seem to work. The line it gets stuck looks like something like this [CODE] my @candidates = $c->bookmarks_for(start => 1, tag =>'pubmed'); [/CODE] Can you please help me. Thank you, Sammed

Member Avatar
0
3
Member Avatar

Hi all. Having more problems with utf-8 and Iñtërnâtiônàlizætiøn. I'm running php (xampp) on Windows 7 (but it's also happening on my remote Linux site) and keep on getting nonsense with non-ASCII chars when they come from include files, e.g. INCLUDE FILE: 'inc.php' [CODE]<?php $simple = "Iñtërnâtiônàlizætiøn"; ?>[/CODE] MAIN FILE [CODE]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="cy-GB" xml:lang="cy-GB"> <head> <meta name="language" content="Welsh" /> <meta http-equiv="Content-Language" content="cy-GB" /> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> </head> <body> <?php include_once("inc.php"); echo $simple . "<br />"; echo "Straight: Iñtërnâtiônàlizætiøn"; ?> </body> </html> </body> </html>[/CODE] I get this: [ATTACH]20097[/ATTACH] I've tried putting …

Member Avatar
0
9
Member Avatar

Hello. I'm working with a webpage where its going to a Google Store Locator. [URL="http://code.google.com/intl/no-NO/apis/maps/articles/phpsqlsearch.html"]Goolge Store Locator guide[/URL] I did follow. I got it working for a while, but here in Norway we have some characters, ÆØÅ that we use. This is the problem. When I search for a place, which contains the letters ÆØÅ the XML generated an error in the error_log file. [14-Feb-2011 14:43:46] PHP Warning: DOMDocument::saveXML() [<a href='domdocument.savexml'>domdocument.savexml</a>]: output conversion failed due to conv error, bytes 0xF8 0x72 0x65 0x20 in /home/vaskepla/public_html/test/phpsqlsearch_genxml.php on line 53 [CODE]<?php require("phpsqlsearch_dbinfo.php"); // Get parameters from URL $center_lat = $_GET["lat"]; $center_lng = …

Member Avatar
0
5
Member Avatar

Hi all. Got a bit of a problem with this. Here's my code: [CODE]<?php header('Content-Type: text/html; charset=utf-8'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php echo strtolower("TWIUBCÜ"); echo "TWIUBCÜ"; ?> </body> </html>[/CODE] OK, perhaps the header and the meta tag are a bit of an overkill, but never mind. The second echo displays the Ü, no problem. The first however, gives me a �! Yes, that horrible diamond encrusted question mark. Now having researched, I know strtolower can't cope with UTF-8 very well, so it suggests …

Member Avatar
0
7
Member Avatar

Hi Guys, I was hoping someone can help me with this. I have a python program that reads and writes files in utf-8(unicode). When I run it in Eclipse, the output is perfectly fine. When I try making an exe file of my program it is not working. I also tried double clicking the python program to run it in windows dos but the same problem occurred. I tried running it in pythonWin still the same problem. Now I have a problem debugging my program since it is working perfectly fine in Eclipse. Is it a problem about encoding? I …

Member Avatar
0
5

The End.