It appears that some browsers can send a very long locale string (I
i *think* that shouldn't happen unless you're having some problem with or are not using the geoLocator CFC. that should just return a java style locale string (eg. th_TH), 5 chars at most. otherwise the browser's CGI var http_accept_language (not exactly a locale) is used and mac's tend to have *the* longest strings i've ever seen (and we do a lot of i18n work) no matter the browser. the OS seems to mysteriously collect them (at least that's what a mac user told me once).
think it was Safari) that will break the stats entry into the database. I've attached a new log.cfm (from /farcry_core/packages/farcry/_stats) that truncates the locale down to 100 chars.
i don't think simply truncating that to 100 chars is a good idea, parsing out the "best" (i.e. preferred) language would probably be better. http_accept_language is a comma delimited list of "languages" sometimes with country modifiers (eg. en-au, the country code can be capitalized or not). sometimes language preferences have a "quality" factor, the "q=" bits in the following:
en,es;q=0.8,zh-TW;q=0.1
you can usually safely ignore these. in fact most folk's most preferred language language usually comes first in the http_accept_language list. so you could do this (if you wanted a really clean "locale" string:
<!--- test & parse incoming "locale" argument --->
<cfset tmpLocale=arguments.locale>
<cfif len(tmpLocale) GT 5> <!--- long http_accept_language string? --->
<!--- q & d get the first "locale" listed --->
<cfset tmpLocale=listFirst(tmpLocale)>
<!--- tagged with quality? --->
<cfif listLen(tmpLocale,";") GT 1>
<!--- get "locale", ignore quality --->
<cfset tmpLocale=listFirst(tmpLocale, ";")>
</cfif>
</cfif>and insert tmpLocale in the db *or* if you don't mind a bit of language preference goop, then simply insert #listFirst(arguments.locale)#
i guess what you do or don't do depends on what you want from that "locale" stat.
--- You are currently subscribed to farcry-dev as: [email protected] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/
