[orca] Fix for bgo# Bug 591734 - "No break space" character not spoken



commit e39653286d19e05546fd054eb305757e1e44e8aa
Author: Willie Walker <william walker sun com>
Date:   Mon Aug 17 10:04:10 2009 -0400

    Fix for bgo# Bug 591734 - "No break space" character not spoken

 src/orca/chnames.py                 |    5 +++++
 src/orca/gnomespeechfactory.py      |    5 +++++
 src/orca/speechdispatcherfactory.py |    4 ++++
 3 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/chnames.py b/src/orca/chnames.py
index f2f0783..216f147 100644
--- a/src/orca/chnames.py
+++ b/src/orca/chnames.py
@@ -174,6 +174,11 @@ chnames["}"] = _("right brace")
 #
 chnames["~"] = _("tilde")
 
+# Translators: this is the spoken character for the no break space
+# character (e.g., "&nbsp;" in HTML -- U+00a0)
+#
+chnames[u'\u00a0'] = _("no break space")
+
 # Translators: this is the spoken word for the character '¡' (U+00a1)
 #
 chnames[u'\u00a1'] = _("inverted exclamation point")
diff --git a/src/orca/gnomespeechfactory.py b/src/orca/gnomespeechfactory.py
index 6e07753..54fe641 100644
--- a/src/orca/gnomespeechfactory.py
+++ b/src/orca/gnomespeechfactory.py
@@ -941,6 +941,11 @@ class SpeechServer(speechserver.SpeechServer):
 
         text = self.__addVerbalizedPunctuation(text)
 
+        # Replace no break space characters with plain spaces since some
+        # synthesizers cannot handle them.  See bug #591734.
+        #
+        text = text.decode("UTF-8").replace(u'\u00a0', ' ').encode("UTF-8")
+
         try:
             # [[[TODO: WDW - back this stop out for now.  The problem is
             # that we end up clipping too much speech, especially in the
diff --git a/src/orca/speechdispatcherfactory.py b/src/orca/speechdispatcherfactory.py
index 70e1fc1..96b064d 100644
--- a/src/orca/speechdispatcherfactory.py
+++ b/src/orca/speechdispatcherfactory.py
@@ -242,6 +242,10 @@ class SpeechServer(speechserver.SpeechServer):
                 current[acss_property] = value
 
     def _speak(self, text, acss, **kwargs):
+        # Replace no break space characters with plain spaces since some
+        # synthesizers cannot handle them.  See bug #591734.
+        #
+        text = text.decode("UTF-8").replace(u'\u00a0', ' ').encode("UTF-8")
         self._apply_acss(acss)
         self._send_command(self._client.speak, text, **kwargs)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]