diff --git a/CRM/Core/Smarty/plugins/modifier.crmCountCharacters.php b/CRM/Core/Smarty/plugins/modifier.crmCountCharacters.php
new file mode 100644
index 000000000000..925acbe52b80
--- /dev/null
+++ b/CRM/Core/Smarty/plugins/modifier.crmCountCharacters.php
@@ -0,0 +1,32 @@
+
+ * Name: crmCountCharacteres
+ * Purpose: count the number of characters in a text with handling for NULL values
+ * @link http://smarty.php.net/manual/en/language.modifier.count.characters.php
+ * count_characters (Smarty online manual)
+ * @author Monte Ohrt
+ * @param string $string
+ * @param boolean $include_spaces include whitespace in the character count
+ * @return integer
+ */
+function smarty_modifier_crmCountCharacters($string, $include_spaces = FALSE) {
+ if ($include_spaces) {
+ return(strlen($string));
+ }
+
+ if (is_null($string)) {
+ return 0;
+ }
+ return preg_match_all("/[^\s]/", $string, $match);
+}
+
+/* vim: set expandtab: */
diff --git a/templates/CRM/Block/Event.tpl b/templates/CRM/Block/Event.tpl
index 92fb90d4f745..ffa45aeec995 100644
--- a/templates/CRM/Block/Event.tpl
+++ b/templates/CRM/Block/Event.tpl
@@ -17,7 +17,7 @@
{$ev.title}
{$ev.start_date|truncate:10:""|crmDate}
{assign var=evSummary value=$ev.summary|truncate:80:""}
- {$evSummary}{if $ev.summary|count_characters:true GT 80} ({ts}more{/ts}...){/if}
+ {$evSummary}{if $ev.summary|crmCountCharacters:true GT 80} ({ts}more{/ts}...){/if}
{/foreach}
{else}
diff --git a/templates/CRM/Contact/Page/View/Note.tpl b/templates/CRM/Contact/Page/View/Note.tpl
index c35f0d2ad38a..64bb783794d1 100644
--- a/templates/CRM/Contact/Page/View/Note.tpl
+++ b/templates/CRM/Contact/Page/View/Note.tpl
@@ -224,7 +224,7 @@
{$note.note|mb_truncate:80:"...":false|nl2br}
{* Include '(more)' link to view entire note if it has been truncated *}
- {assign var="noteSize" value=$note.note|count_characters:true}
+ {assign var="noteSize" value=$note.note|crmCountCharacters:true}
{if $noteSize GT 80}
{/if}
diff --git a/xml/templates/schema.tpl b/xml/templates/schema.tpl
index afb0192fc690..50a11fd18b8c 100644
--- a/xml/templates/schema.tpl
+++ b/xml/templates/schema.tpl
@@ -32,7 +32,7 @@ CREATE TABLE `{$table.name}` ({assign var='first' value=true}
{foreach from=$table.fields item=field}
{if ! $first},{/if}{assign var='first' value=false}
- `{$field.name}` {$field.sqlType}{if $field.collate} COLLATE {$field.collate}{/if}{if $field.required} {if $field.required == "false"}NULL{else}NOT NULL{/if}{/if}{if isset($field.autoincrement)} AUTO_INCREMENT{/if}{if $field.default|count_characters} DEFAULT {$field.default}{/if}{if $field.comment} COMMENT '{ts escape=sql}{$field.comment}{/ts}'{/if}
+ `{$field.name}` {$field.sqlType}{if $field.collate} COLLATE {$field.collate}{/if}{if $field.required} {if $field.required == "false"}NULL{else}NOT NULL{/if}{/if}{if isset($field.autoincrement)} AUTO_INCREMENT{/if}{if $field.default|crmCountCharacters} DEFAULT {$field.default}{/if}{if $field.comment} COMMENT '{ts escape=sql}{$field.comment}{/ts}'{/if}
{/foreach}{* table.fields *}{strip}
{/strip}{if $table.primaryKey}{if !$first},
|