Squarepusher
-
Posts
8 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by Squarepusher
-
-
No, I changed those variables in phpMyAdmin.
-
I set "collation connection", "collation server" and "collation database" to "utf8_general_ci" and "character set server", "character set results", "character set filesystem", "character set database", "character set connection" and "character set client" to "utf8" but it still doesn't help.
-
No matter what I try, unicode characters that are read from a MySQL database like japanese ones are replaced by "?" while characters like "ä", "ö", "ü", "»", "«", etc. are replaced by "�".
I pasted this at the top of the PHP code:
header('Content-Type: text/html; charset=UTF-8'); mb_internal_encoding('UTF-8'); mb_http_output('UTF-8'); mb_http_input('UTF-8'); mb_regex_encoding('UTF-8');
I saved the PHP file as UTF-8 and UTF-8 without BOM and put <meta charset="UTF-8"> into it. (When I insert unicode characters directly in the file, they're displayed correctly, though...)
I set the encoding in the phpMyAdmin database table to different "UTF-8" encodings. (They're displayed correctly too when viewed in the table directly...)
Nothing worked so far.
Any ideas?
-
I thought the opposite way and changed "c" to "C" because it also didn't work.Never mind, I found the error. Instead of "document.addEventListener" you must use window.addEventListener instead...
-
I tried to add a "hashChange" event to the body element using the "onload" event, but nothing happens when the hash changes:
document.addEventListener("hashChange", function() { alert(location.hash); });
But t works when I add
onhashchange="alert(location.hash)"
to the body element? Why?
-
You need a better way to structure your data. Something like this, for example:
{ name : "MainArray", data : [ { name : "SubArray1", data : [ ... ] }, { name : "SubArray2", data : [ ... ] }, { name : "SubArray3", data : [ ... ] } ] }
I don't know how to access these array...
You don't explain why you have this type of data-structure.
I want to change content on the page without loading a whole new page. Just like AJAX.
-
Hello,
I'm currently learning JavaScript and I plan to work a lot with arrays. I store all arrays in external files and use JSON to access them. Now I wanted to read the names of all arrays that are nested in one main array to create a navigation list but I don't know how to do that.
This is an example of a JSON file I use:
{"MainArray":[ {"SubArray1":[{ ... }] }, {"SubArray2":[{ ... }] }, {"SubArray3":[{ ... }] } ]}
How do I get the names of all SubArrays? I tried this
// arr is a JSON-parsed string function myFunction(arr) { var out = ""; var i; for(i = 0; i < arr.MainArray.length; i++) { out += arr.MainArray[i].toString() + '<br>'; } document.getElementById("aso").innerHTML = out; }
but it only creates a list of "[object Object]" items. Should I create another JSON file where all array names are listed instead?
Unicode characters displayed incorrectly
in PHP
Posted
Oh, I didn't know this. Thanks, it works now!