Questions tagged [multibyte-functions]

41 questions
0
votes
1 answer

Display-width of multibyte character in C standard library – how accurate is the database?

The wcwidth call of Standard C Library returns 2 for Asian characters. Then there are Unicode symbols, like arrows. For those it returns 1. It is often the case that character is wider than single column, yet the library isn't wrong, because…
Digger
  • 103
  • 1
  • 1
  • 4
0
votes
1 answer

Reliably rotating any string

I was experimenting with multibyte strings and how to handle them. Using the code that you can see here https://gist.github.com/charlydagos/89f67808e01f97e6de91 I was successful in rotating most strings. However I noticed that the line $chr =…
Carlos D
  • 180
  • 1
  • 8
0
votes
0 answers

WideCharToMultiByte produces Chinese characters when writing to registery

I have this ancient bit of code for an IE BHO, and I'm trying to store some data for it. I'm trying this approach: // key is an LPWSTR provided as a method parameter // sValue is an LPWSTR provided as a method parameter HKEY hKey = NULL; HRESULT…
0
votes
0 answers

Not all ASCII characters transcoded to wchar_t by mbstowcs

I looked into a number of similar questions but I can't seem to find a solution to my problem: I am trying to convert characters from ASCII to wide characters (Windows UTF16) to print them on a window (the purpose is to capture custom character sets…
0
votes
1 answer

PHP and UTF-8 String functions WITHOUT MB-Functions?

I try to use UTF-8 with PHP, the Output seems okay (Display correct äöüß etc, when testing) on my Site, but there is a simply Problem... When I use echo strlen("Ä"); it shows me "2"... I read this Topic: strlen() and UTF-8 encoding In the answer I…
Petschko
  • 168
  • 3
  • 16
0
votes
2 answers

How can I get the correct position of a word in a UTF-8 text?

I have a simple PHP code to get a sentences of a text and bold an specific word. First of all I get an array with the words that I want and their position in the text. $all_words = str_word_count($text, 2, 'åæéø'); // $words is an array with the…
ilazgo
  • 650
  • 2
  • 11
  • 35
0
votes
2 answers

PHP: Arabic characters as array keys

I want to implement a simple Arabic to English transliteration. I have defined a mapping array like the following: $mapping = array('ﺏ' => 'b', 'ﺕ' => 't', ...) I expect the following code to convert an Arabic string to its corresponding…
a_fan
  • 383
  • 2
  • 22
0
votes
2 answers

REGEXP to convert any 3 chars or less word to wordVVV

I am trying to convert any occurrence of a word with 3 chars or less to the same word with the string VVV attached to it. Example: for -> forVVV I am using none Latin chars (UTF8), hence the MB. What I have is: …
Itay Moav -Malimovka
  • 52,579
  • 61
  • 190
  • 278
0
votes
1 answer

Combine several mb_ereg_replace()-calls

How can I combine these replacements into one regular expression? $style = $node->getAttribute("style"); $style = mb_ereg_replace("(direction:[[:space:]]*(rtl|ltr);)", "", $style) . " direction: {$direction};"; // remove existing…
fragmentedreality
  • 1,287
  • 9
  • 31
-1
votes
1 answer

Truncate a multibyte string to approximately n words with PHP mb functions

after asking this question on SO, I needed to prepare a custom PHP function to get a brief version of my string cause I couldn't find a direct answer / code on web. requirements were: aware of multibyte language for characters like ş , ı , ğ…
Andre Chenier
  • 1,166
  • 2
  • 18
  • 37
-3
votes
2 answers

How to find whether byte read is japanese or english?

I have an array which contains Japanese and ascii characters. I am trying to find whether characters read is English character or Japanese characters. in order to solve this i followed as read first byte , if multicharcterswidth is not equal to…
Suri
  • 3,287
  • 9
  • 45
  • 75
1 2
3