Inserting a spanish symbol like á or similar makes the marker to break with a message like this one:

Error: unterminated string literal
Archivo fuente: http://bodaestilo.com/es/user/1
Línea: 26, Columna: 42
Código fuente:
Casita de la novia";marker1.description = "Desde aqui saldrá la novio.

and:

Error: field_el_mapa_de_vuestra_boda0markers is not defined
Archivo fuente: http://bodaestilo.com/es/user/1
Línea: 30

the solution could be passing utf8 the input from the javascript:

this.useTitle ? title = document.getElementById("edit-"+ this.prefix +"-" + i +"-title").value : title = '';
this.useDescription ? description = document.getElementById("edit-"+ this.prefix +"-" + i +"-description").value : description = '';

CommentFileSizeAuthor
#1 cck_map-v02192008.zip34.91 KBalexmoreno

Comments

alexmoreno’s picture

StatusFileSize
new34.91 KB

i´ve solved the international characters problem encoding the input to ascii with runcharcodeat function:

var txtValidado = runCharCodeAt(this.markerList[i].description);

the idea is to publish only ascii codes in the php so we have this on the html code:

marker0.description = "108,117,103,97,114,32,100,101,32,108,97,32,98,111,100,97,10,10,112,98,111,114,97,110,100,111,32,50";

so we avoid the problem with international characters but also with the \n character, also encoded in ascii and decoded when the javascript needs it. I attach all the code including my improvements to the image icon modifications.

i still have to do this with the tittle input, but at this time it seems very trivial.

alexmoreno’s picture

Status: Active » Fixed
kyvos’s picture

I had the same problem when markers contains greek characters. I solved changing cck_map_create_markers_js function to use UTF-8 encoding like this :

function cck_map_create_markers_js($items, $js_prefix) {
static $cck_map_nummaps;
$vars ="var {$js_prefix}{$cck_map_nummaps}markers = new Array();";
$on_load = "";
foreach ($items as $delta => $item) {
if (is_numeric($delta) && $item['lat'] && $item['lon']) {
$on_load .= "var marker{$delta} = new Object();";
$on_load .= "marker{$delta}.lat = ". $item['lat'] .";";
$on_load .= "marker{$delta}.lon = ". $item['lon'] .";";
$on_load .= "marker{$delta}.title = \"". htmlentities($item['title'],ENT_COMPAT,"UTF-8") ."\";";
$on_load .= "marker{$delta}.description = \"". htmlentities($item['description'],ENT_COMPAT,"UTF-8") ."\";";
$on_load .= "marker{$delta}.image = '". $item['image'] ."';";
$on_load .= "{$js_prefix}{$cck_map_nummaps}markers[{$js_prefix}{$cck_map_nummaps}markers.length] = marker{$delta};";
}
}
drupal_add_js("{$vars}\$(document).ready(function() { ". $on_load ." } ); ", 'inline');
}

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

alexmoreno’s picture

better and simpliest solution. Did it worked for you with \n characters?