Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
replacerx and unicode pattern
#1
Hopefully, this is my last enquiry regarding unicode : what about replacing unicode characters in that it concerns the pattern. In the case of ANSI one can use [13] or [32] (instead of space). In unicode how should one search for character 931?

Thanks.
#2
Simply type the character. Why to use character code?
#3
Good question. It is frequently that I receive e-mails with filenames using unicode characters with different code pages. These characters are not recognised as valid file name characters (actually they are displayed as boxes, or in a strange way, ex. "辛匝_ W_ doc"). I want to replace them using str.ReplaceInvalidFilenameCharacters. I know the unicode character codes in my language, I want to exclude others. Thanks.
#4
try this

Macro
Code:
Copy      Help
str s="辛匝_ W_č doc" ;;UTF8
s.unicode ;;to UTF16
s.ansi(s CP_ACP) ;;to ANSI, using your system ANSI code page. This probably will replace foreign unicode characters to ?.
s.unicode(s CP_ACP)
s.ansi ;;to UTF8
out s
;now ReplaceInvalidFilenameCharacters will replace ? to _
#5
this probably will not be useful in your case

Macro
Code:
Copy      Help
;creates QM string where a unicode character is as escape sequence

int unicode_character_code=931 ;;change this

BSTR b=" "
b[0]=unicode_character_code
str s=b
int i
str ss
for i 0 s.len
,ss.formata("[%i]" s[i])
out ss
#6
Once more, many thanks.


Forum Jump:


Users browsing this thread: 1 Guest(s)