Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Encoding Issues for Vietnamese Addresses #49

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion represent-map/add.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
} else {

// insert into db, wait for approval
$insert = mysql_query("INSERT INTO places (approved, title, type, address, uri, description, owner_name, owner_email) VALUES (null, '$title', '$type', '$address', '$uri', '$description', '$owner_name', '$owner_email')") or die(mysql_error());
$insert = mysql_query("INSERT INTO places (approved, title, type, address, uri, description, owner_name, owner_email) VALUES (null, '$title', '$type', _utf8'$address', '$uri', '$description', _utf8'$owner_name', '$owner_email')") or die(mysql_error());

// geocode new submission
$hide_geocode_output = true;
Expand Down
2 changes: 1 addition & 1 deletion represent-map/admin/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
exit;
}


mysql_query("SET NAMES 'utf8'");
// get place info
$place_query = mysql_query("SELECT * FROM places WHERE id='$place_id' LIMIT 1");
if(mysql_num_rows($place_query) != 1) { exit; }
Expand Down
1 change: 1 addition & 0 deletions represent-map/admin/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
$admin_head = "
<html>
<head>
<meta charset='UTF-8'>
<title>RepresentMap Admin</title>
<link href='../bootstrap/css/bootstrap.css' rel='stylesheet' type='text/css' />
<link href='../bootstrap/css/bootstrap-responsive.css' rel='stylesheet' type='text/css' />
Expand Down
2 changes: 1 addition & 1 deletion represent-map/admin/index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
$page = "index";
include "header.php";

mysql_query("SET NAMES 'utf8'"); // for special chars like Vietnamese

// hide marker on map
if($task == "hide") {
Expand Down
2 changes: 1 addition & 1 deletion represent-map/geocode.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function geocode($table) {
$geocode_pending = true;

while ($geocode_pending) {
$address = $row["address"];
$address = utf8_encode($row["address"]);// encode utf 8 for Vietnamese chars
$id = $row["id"];
$request_url = $base_url . "?address=" . urlencode($address) . "&sensor=false";
$xml = simplexml_load_file($request_url) or die("url not loading");
Expand Down
2 changes: 1 addition & 1 deletion represent-map/include/db_example.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,4 @@



?>
?>
1 change: 1 addition & 0 deletions represent-map/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ function initialize() {
Array('event', 'Events'),
);
$marker_id = 0;
mysql_query("SET NAMES 'utf8'");
foreach($types as $type) {
$places = mysql_query("SELECT * FROM places WHERE approved='1' AND type='$type[0]' ORDER BY title");
$places_total = mysql_num_rows($places);
Expand Down