Fix korean NFC problem on console
This commit is contained in:
@@ -8,9 +8,10 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
341F5ED42A0A8B9000962D48 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 341F5ED32A0A8B9000962D48 /* main.swift */; };
|
||||
341F5EDC2A0A8C4600962D48 /* KissMe.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 341F5EDB2A0A8C4600962D48 /* KissMe.framework */; };
|
||||
341F5F052A13B82F00962D48 /* test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 341F5F042A13B82F00962D48 /* test.swift */; };
|
||||
341F5F092A1463A100962D48 /* KissConsole.swift in Sources */ = {isa = PBXBuildFile; fileRef = 341F5F082A1463A100962D48 /* KissConsole.swift */; };
|
||||
34EE76862A1C391B009761D2 /* KissMe.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 341F5EDB2A0A8C4600962D48 /* KissMe.framework */; };
|
||||
34EE76872A1C391B009761D2 /* KissMe.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 341F5EDB2A0A8C4600962D48 /* KissMe.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
@@ -23,6 +24,17 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
34EE76882A1C391B009761D2 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
34EE76872A1C391B009761D2 /* KissMe.framework in Embed Frameworks */,
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@@ -38,7 +50,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
341F5EDC2A0A8C4600962D48 /* KissMe.framework in Frameworks */,
|
||||
34EE76862A1C391B009761D2 /* KissMe.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -90,6 +102,7 @@
|
||||
341F5ECC2A0A8B9000962D48 /* Sources */,
|
||||
341F5ECD2A0A8B9000962D48 /* Frameworks */,
|
||||
341F5ECE2A0A8B9000962D48 /* CopyFiles */,
|
||||
34EE76882A1C391B009761D2 /* Embed Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1430"
|
||||
version = "1.7">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "341F5ECF2A0A8B9000962D48"
|
||||
BuildableName = "KissMeConsole"
|
||||
BlueprintName = "KissMeConsole"
|
||||
ReferencedContainer = "container:KissMeConsole.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
shouldAutocreateTestPlan = "YES">
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "YES"
|
||||
customWorkingDirectory = "$(SRCROOT)/../bin"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES"
|
||||
viewDebuggingEnabled = "No"
|
||||
consoleMode = "1">
|
||||
<PathRunnable
|
||||
runnableDebuggingMode = "0"
|
||||
BundleIdentifier = "com.googlecode.iterm2"
|
||||
FilePath = "/Applications/iTerm.app">
|
||||
</PathRunnable>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "341F5ECF2A0A8B9000962D48"
|
||||
BuildableName = "KissMeConsole"
|
||||
BlueprintName = "KissMeConsole"
|
||||
ReferencedContainer = "container:KissMeConsole.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<CommandLineArguments>
|
||||
<CommandLineArgument
|
||||
argument = "${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}"
|
||||
isEnabled = "YES">
|
||||
</CommandLineArgument>
|
||||
</CommandLineArguments>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "341F5ECF2A0A8B9000962D48"
|
||||
BuildableName = "KissMeConsole"
|
||||
BlueprintName = "KissMeConsole"
|
||||
ReferencedContainer = "container:KissMeConsole.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -40,7 +40,8 @@
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES"
|
||||
viewDebuggingEnabled = "No">
|
||||
viewDebuggingEnabled = "No"
|
||||
consoleMode = "1">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
|
||||
@@ -130,8 +130,8 @@ extension KissConsole {
|
||||
defer {
|
||||
productsLock.unlock()
|
||||
}
|
||||
// return products.filter { $0.key.contains(similarName) }
|
||||
return products.filter { $0.key.localizedStandardContains(similarName) }
|
||||
return products.filter { $0.key.contains(similarName) }
|
||||
// return products.filter { $0.key.decomposedStringWithCanonicalMapping.contains(similarName) }
|
||||
}
|
||||
|
||||
private func loadShop(_ profile: Bool = true) {
|
||||
@@ -306,9 +306,8 @@ extension KissConsole {
|
||||
return
|
||||
}
|
||||
for item in items {
|
||||
print("Product \(item.key)")
|
||||
for value in item.value {
|
||||
print("\t\(value.shortCode) \(value.baseDate)")
|
||||
if let first = item.value.first {
|
||||
print("\(first.shortCode) \(item.key.maxSpace(20)) \(first.marketCategory) \(first.baseDate)")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -317,11 +316,21 @@ extension KissConsole {
|
||||
|
||||
private extension Array {
|
||||
func suffixStrings(from: Int) -> [String] where Element == String.SubSequence {
|
||||
/// https://ios-development.tistory.com/162
|
||||
/// Korean NFD(Normalization Form Canonical Decomposition) to NFC(Normalization Form Canonical Composition)
|
||||
guard from < count else {
|
||||
return []
|
||||
}
|
||||
return suffix(from: from).map { String($0) }
|
||||
}
|
||||
}
|
||||
|
||||
private extension String {
|
||||
func maxSpace(_ length: Int) -> String {
|
||||
let count = unicodeScalars.reduce(0) {
|
||||
$0 + ($1.value >= 0x80 ? 2: 1)
|
||||
}
|
||||
if count < length {
|
||||
return appending(String(repeating: " ", count: length - count))
|
||||
}
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,4 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
//let a = String("ㅅㅏㅁㅅㅓㅇ".utf16)
|
||||
//print(a.decomposedStringWithCanonicalMapping)
|
||||
//print(a.precomposedStringWithCanonicalMapping)
|
||||
|
||||
KissConsole().run()
|
||||
|
||||
Reference in New Issue
Block a user