[OpenBIOS] [PATCH 2/3] Fix HFS+ display for non-ASCII characters.

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Tue Sep 18 17:31:39 CEST 2012


Replace any non-ASCII characters with a ? to prevent display
errors when converting from Unicode filenames.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 openbios-devel/fs/hfsplus/hfsp_unicode.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/openbios-devel/fs/hfsplus/hfsp_unicode.c b/openbios-devel/fs/hfsplus/hfsp_unicode.c
index a798085..22da3fa 100644
--- a/openbios-devel/fs/hfsplus/hfsp_unicode.c
+++ b/openbios-devel/fs/hfsplus/hfsp_unicode.c
@@ -43,7 +43,10 @@ uni2asc( char *astr, const unsigned char *ustr, int ustrlen, int maxlen )
 		/* might be unrepresentable (or too complicated for us) */
 		if( ustr[0] || !ustr[1] )
 			continue;
-		*astr++ = ustr[1];
+		if( ustr[1] < 0x20 || ustr[1] > 0x80 )
+		    *astr++ = '?';
+		else
+		    *astr++ = ustr[1];
 		len++;
 	}
 	*astr = 0;
-- 
1.7.10.4




More information about the OpenBIOS mailing list