Permalink
Browse files

Converted special characters into underscore_. Added .Content to all …

…keys
  • Loading branch information...
shifu committed Apr 14, 2012
1 parent 26e6ed1 commit 2dc5e3038ee60d3ec84c08a73ac890871e1d7257
Showing with 7 additions and 3 deletions.
  1. +7 −3 ios2metro.rb
View
@@ -123,9 +123,13 @@ def output_xml (result, attri)
end
if parts[1] == separator
value = (parts[2][0..parts[2].index('";'.encode('UTF-16LE'))-1]).encode('UTF-8')
- # no need to replace special chars to underscore _.
- # only Android requires that.
- key = (parts[0][1..-1].downcase
+ # replace special chars to underscore _ in key
+ regex = get_regex('[ ()/,\.\'\?:!\-&><]',line.encoding,16) # //u = 00010000 option bit set = 16
+ key = (parts[0][1..-1].downcase.gsub regex, '_'.encode('UTF-16LE')).encode('UTF-8')
+
+ # Append .Content to every key
+ key = key + '.Content'
+
# replace %@ to %s
key = key.gsub '%@', '%s'
value = (value.gsub '%@', '%s').gsub "'", "\\'"

0 comments on commit 2dc5e30

Please sign in to comment.