-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue #8375: Lowercase search does not find non-ASCII uppercase pages…
… and vice versa
- Loading branch information
Showing
19 changed files
with
3,334 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# python3 script to generate caseconvert.h. | ||
This comment has been minimized.
Sorry, something went wrong. |
||
# It uses difference in lower() and upper() on a character to make a mapping | ||
# that maps a given unicode point to either a lower or upper case UTF-8 character. | ||
# this also include multi-byte characters. | ||
|
||
import codecs | ||
|
||
toupper = {} | ||
tolower = {} | ||
|
||
def writeMapping(file,mapping): | ||
for k,v in sorted(mapping.items()): | ||
file.write(u" case %s /* %s */: return u8\"%s\" /* %s */;\n" % | ||
(hex(ord(k[0])),k,v,",".join("0x{:02x}".format(ord(c)) for c in v))) | ||
|
||
# create mappings of characters whose upper and lower case differs | ||
for codeValue in range(0,0x1FFFF): | ||
s = chr(codeValue) | ||
sl = s.lower() | ||
su = s.upper() | ||
if ord(s[0])!=ord(sl[0]): | ||
tolower[s]=sl | ||
if ord(s[0])!=ord(su[0]): | ||
toupper[s]=su | ||
|
||
file = codecs.open("caseconvert.h", "w", "utf-8") | ||
file.write(r'''/** This file is generated by python3 caseconvert.py. DO NOT EDIT! */ | ||
#ifndef CASECONVERT_H | ||
#define CASECONVERT_H | ||
#include <cstdint> | ||
#include <string> | ||
inline const char *convertUnicodeToUpper(uint32_t code) | ||
{ | ||
switch(code) | ||
{ | ||
'''); | ||
writeMapping(file,toupper); | ||
file.write(r''' default: return nullptr; | ||
} | ||
} | ||
inline const char *convertUnicodeToLower(uint32_t code) | ||
{ | ||
switch(code) | ||
{ | ||
'''); | ||
writeMapping(file,tolower); | ||
file.write(r''' default: return nullptr; | ||
} | ||
} | ||
#endif | ||
'''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
I don't think it is a good idea to have this file in the
src
directoryCMakeList.txt
for generation of thecaseconvert.h
file and is only used to generate the initialcaseconvert.h
tools
directory (note might require small change in the file as creates thecaseconvert.h
on the current directory)