Full Code of biggercoffee/ZXPUnicode for AI

master 3f5d409ea403 cached
8 files
15.0 KB
4.8k tokens
1 requests
Download .txt
Repository: biggercoffee/ZXPUnicode
Branch: master
Commit: 3f5d409ea403
Files: 8
Total size: 15.0 KB

Directory structure:
gitextract_tekxsig1/

├── .gitignore
├── LICENSE
├── README.md
├── ZXPUnicode/
│   ├── ZXPUnicode.h
│   └── ZXPUnicode.m
└── demo/
    ├── demo/
    │   └── main.m
    └── demo.xcodeproj/
        ├── project.pbxproj
        └── project.xcworkspace/
            └── contents.xcworkspacedata

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
#
#Pods/


================================================
FILE: LICENSE
================================================
The MIT License (MIT)

Copyright (c) 2015 

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



================================================
FILE: README.md
================================================
# ZXPUnicode
在Xcode的控制台里支持array and dictionary 的中文输出,Xcode默认是不支持的.导入分类即可在控制台自动支持中文输出


================================================
FILE: ZXPUnicode/ZXPUnicode.h
================================================
//
//  ZXPUnicode.h
//
//  blog : http://blog.csdn.net/biggercoffee
//  github : https://github.com/biggercoffee/ZXPUnicode
//
//  Created by Mango on 2017/3/31.
//  Copyright © 2017年 coffee. All rights reserved.
//

#import <Foundation/Foundation.h>




================================================
FILE: ZXPUnicode/ZXPUnicode.m
================================================
//
//  ZXPUnicode.m
//
//  blog : http://blog.csdn.net/biggercoffee
//  github : https://github.com/biggercoffee/ZXPUnicode
//
//  Created by Mango on 2017/3/31.
//  Copyright © 2017年 coffee. All rights reserved.
//

#import "ZXPUnicode.h"
#import <objc/runtime.h>

static inline void zxp_swizzleSelector(Class class, SEL originalSelector, SEL swizzledSelector) {
    Method originalMethod = class_getInstanceMethod(class, originalSelector);
    Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
    if (class_addMethod(class, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod))) {
        class_replaceMethod(class, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod));
    } else {
        method_exchangeImplementations(originalMethod, swizzledMethod);
    }
}

@implementation NSString (ZXPUnicode)

- (NSString *)stringByReplaceUnicode {
    NSMutableString *convertedString = [self mutableCopy];
    [convertedString replaceOccurrencesOfString:@"\\U"
                                     withString:@"\\u"
                                        options:0
                                          range:NSMakeRange(0, convertedString.length)];
    
    CFStringRef transform = CFSTR("Any-Hex/Java");
    CFStringTransform((__bridge CFMutableStringRef)convertedString, NULL, transform, YES);
    return convertedString;
}

@end

@implementation NSArray (ZXPUnicode)

+ (void)load {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        Class class = [self class];
        zxp_swizzleSelector(class, @selector(description), @selector(zxp_description));
        zxp_swizzleSelector(class, @selector(descriptionWithLocale:), @selector(zxp_descriptionWithLocale:));
        zxp_swizzleSelector(class, @selector(descriptionWithLocale:indent:), @selector(zxp_descriptionWithLocale:indent:));
    });
}

/**
 *  我觉得 
 *  可以把以下的方法放到一个NSObject的category中
 *  然后在需要的类中进行swizzle
 *  但是又觉得这样太粗暴了。。。。
 */

- (NSString *)zxp_description {
    return [[self zxp_description] stringByReplaceUnicode];
}

- (NSString *)zxp_descriptionWithLocale:(nullable id)locale {
    return [[self zxp_descriptionWithLocale:locale] stringByReplaceUnicode];
}

- (NSString *)zxp_descriptionWithLocale:(nullable id)locale indent:(NSUInteger)level {
    return [[self zxp_descriptionWithLocale:locale indent:level] stringByReplaceUnicode];
}

@end

@implementation NSDictionary (ZXPUnicode)

+ (void)load {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        Class class = [self class];
        zxp_swizzleSelector(class, @selector(description), @selector(zxp_description));
        zxp_swizzleSelector(class, @selector(descriptionWithLocale:), @selector(zxp_descriptionWithLocale:));
        zxp_swizzleSelector(class, @selector(descriptionWithLocale:indent:), @selector(zxp_descriptionWithLocale:indent:));
    });
}

- (NSString *)zxp_description {
    return [[self zxp_description] stringByReplaceUnicode];
}

- (NSString *)zxp_descriptionWithLocale:(nullable id)locale {
    return [[self zxp_descriptionWithLocale:locale] stringByReplaceUnicode];
}

- (NSString *)zxp_descriptionWithLocale:(nullable id)locale indent:(NSUInteger)level {
    return [[self zxp_descriptionWithLocale:locale indent:level] stringByReplaceUnicode];
}

@end

@implementation NSSet (ZXPUnicode)

+ (void)load {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        Class class = [self class];
        zxp_swizzleSelector(class, @selector(description), @selector(zxp_description));
        zxp_swizzleSelector(class, @selector(descriptionWithLocale:), @selector(zxp_descriptionWithLocale:));
        zxp_swizzleSelector(class, @selector(descriptionWithLocale:indent:), @selector(zxp_descriptionWithLocale:indent:));
    });
}

- (NSString *)zxp_description {
    return [[self zxp_description] stringByReplaceUnicode];
}

- (NSString *)zxp_descriptionWithLocale:(nullable id)locale {
    return [[self zxp_descriptionWithLocale:locale] stringByReplaceUnicode];
}

- (NSString *)zxp_descriptionWithLocale:(nullable id)locale indent:(NSUInteger)level {
    return [[self zxp_descriptionWithLocale:locale indent:level] stringByReplaceUnicode];
}

@end



================================================
FILE: demo/demo/main.m
================================================
//
//  main.m
//  demo
//
//  blog : http://blog.csdn.net/biggercoffee
//  github : https://github.com/biggercoffee/ZXPUnicode

//  Created by coffee on 15/11/23.
//  Copyright © 2015年 coffee. All rights reserved.
//

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        NSMutableString *mutableString = [@"中文可变字符串" mutableCopy];
        
        NSDictionary *dictionary = @{@"中文key": @"中文value"};
        NSArray *array = @[@"第一个中文数组的值", @"第二个中文数组的值", mutableString];
        NSSet *set = [[NSSet alloc] initWithArray:array];
        
        NSLog(@"dictionary:%@",dictionary);
        NSLog(@"array:%@",array);
        NSLog(@"set:%@",set);
    }
    return 0;
}


================================================
FILE: demo/demo.xcodeproj/project.pbxproj
================================================
// !$*UTF8*$!
{
	archiveVersion = 1;
	classes = {
	};
	objectVersion = 46;
	objects = {

/* Begin PBXBuildFile section */
		1D61351F1C031B0D00CAE85F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D61351E1C031B0D00CAE85F /* main.m */; };
		DBFC175A1E8E5FE900A3DFF1 /* ZXPUnicode.m in Sources */ = {isa = PBXBuildFile; fileRef = DBFC17591E8E5FE900A3DFF1 /* ZXPUnicode.m */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
		1D6135191C031B0D00CAE85F /* CopyFiles */ = {
			isa = PBXCopyFilesBuildPhase;
			buildActionMask = 2147483647;
			dstPath = /usr/share/man/man1/;
			dstSubfolderSpec = 0;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 1;
		};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
		1D61351B1C031B0D00CAE85F /* demo */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = demo; sourceTree = BUILT_PRODUCTS_DIR; };
		1D61351E1C031B0D00CAE85F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
		DBFC17581E8E5FE900A3DFF1 /* ZXPUnicode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZXPUnicode.h; sourceTree = "<group>"; };
		DBFC17591E8E5FE900A3DFF1 /* ZXPUnicode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZXPUnicode.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
		1D6135181C031B0D00CAE85F /* Frameworks */ = {
			isa = PBXFrameworksBuildPhase;
			buildActionMask = 2147483647;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
		1D6135121C031B0D00CAE85F = {
			isa = PBXGroup;
			children = (
				1D61351D1C031B0D00CAE85F /* demo */,
				1D61351C1C031B0D00CAE85F /* Products */,
			);
			sourceTree = "<group>";
		};
		1D61351C1C031B0D00CAE85F /* Products */ = {
			isa = PBXGroup;
			children = (
				1D61351B1C031B0D00CAE85F /* demo */,
			);
			name = Products;
			sourceTree = "<group>";
		};
		1D61351D1C031B0D00CAE85F /* demo */ = {
			isa = PBXGroup;
			children = (
				1D61352F1C031BF200CAE85F /* ZXPUnicode */,
				1D61351E1C031B0D00CAE85F /* main.m */,
			);
			path = demo;
			sourceTree = "<group>";
		};
		1D61352F1C031BF200CAE85F /* ZXPUnicode */ = {
			isa = PBXGroup;
			children = (
				DBFC17581E8E5FE900A3DFF1 /* ZXPUnicode.h */,
				DBFC17591E8E5FE900A3DFF1 /* ZXPUnicode.m */,
			);
			name = ZXPUnicode;
			path = ../../ZXPUnicode;
			sourceTree = "<group>";
		};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
		1D61351A1C031B0D00CAE85F /* demo */ = {
			isa = PBXNativeTarget;
			buildConfigurationList = 1D6135221C031B0D00CAE85F /* Build configuration list for PBXNativeTarget "demo" */;
			buildPhases = (
				1D6135171C031B0D00CAE85F /* Sources */,
				1D6135181C031B0D00CAE85F /* Frameworks */,
				1D6135191C031B0D00CAE85F /* CopyFiles */,
			);
			buildRules = (
			);
			dependencies = (
			);
			name = demo;
			productName = demo;
			productReference = 1D61351B1C031B0D00CAE85F /* demo */;
			productType = "com.apple.product-type.tool";
		};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
		1D6135131C031B0D00CAE85F /* Project object */ = {
			isa = PBXProject;
			attributes = {
				LastUpgradeCheck = 0710;
				ORGANIZATIONNAME = coffee;
				TargetAttributes = {
					1D61351A1C031B0D00CAE85F = {
						CreatedOnToolsVersion = 7.1.1;
					};
				};
			};
			buildConfigurationList = 1D6135161C031B0D00CAE85F /* Build configuration list for PBXProject "demo" */;
			compatibilityVersion = "Xcode 3.2";
			developmentRegion = English;
			hasScannedForEncodings = 0;
			knownRegions = (
				en,
			);
			mainGroup = 1D6135121C031B0D00CAE85F;
			productRefGroup = 1D61351C1C031B0D00CAE85F /* Products */;
			projectDirPath = "";
			projectRoot = "";
			targets = (
				1D61351A1C031B0D00CAE85F /* demo */,
			);
		};
/* End PBXProject section */

/* Begin PBXSourcesBuildPhase section */
		1D6135171C031B0D00CAE85F /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				1D61351F1C031B0D00CAE85F /* main.m in Sources */,
				DBFC175A1E8E5FE900A3DFF1 /* ZXPUnicode.m in Sources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXSourcesBuildPhase section */

/* Begin XCBuildConfiguration section */
		1D6135201C031B0D00CAE85F /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_SEARCH_USER_PATHS = NO;
				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
				CLANG_CXX_LIBRARY = "libc++";
				CLANG_ENABLE_MODULES = YES;
				CLANG_ENABLE_OBJC_ARC = YES;
				CLANG_WARN_BOOL_CONVERSION = YES;
				CLANG_WARN_CONSTANT_CONVERSION = YES;
				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
				CLANG_WARN_EMPTY_BODY = YES;
				CLANG_WARN_ENUM_CONVERSION = YES;
				CLANG_WARN_INT_CONVERSION = YES;
				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
				CLANG_WARN_UNREACHABLE_CODE = YES;
				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
				CODE_SIGN_IDENTITY = "-";
				COPY_PHASE_STRIP = NO;
				DEBUG_INFORMATION_FORMAT = dwarf;
				ENABLE_STRICT_OBJC_MSGSEND = YES;
				ENABLE_TESTABILITY = YES;
				GCC_C_LANGUAGE_STANDARD = gnu99;
				GCC_DYNAMIC_NO_PIC = NO;
				GCC_NO_COMMON_BLOCKS = YES;
				GCC_OPTIMIZATION_LEVEL = 0;
				GCC_PREPROCESSOR_DEFINITIONS = (
					"DEBUG=1",
					"$(inherited)",
				);
				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
				GCC_WARN_UNDECLARED_SELECTOR = YES;
				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
				GCC_WARN_UNUSED_FUNCTION = YES;
				GCC_WARN_UNUSED_VARIABLE = YES;
				MACOSX_DEPLOYMENT_TARGET = 10.11;
				MTL_ENABLE_DEBUG_INFO = YES;
				ONLY_ACTIVE_ARCH = YES;
				SDKROOT = macosx;
			};
			name = Debug;
		};
		1D6135211C031B0D00CAE85F /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_SEARCH_USER_PATHS = NO;
				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
				CLANG_CXX_LIBRARY = "libc++";
				CLANG_ENABLE_MODULES = YES;
				CLANG_ENABLE_OBJC_ARC = YES;
				CLANG_WARN_BOOL_CONVERSION = YES;
				CLANG_WARN_CONSTANT_CONVERSION = YES;
				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
				CLANG_WARN_EMPTY_BODY = YES;
				CLANG_WARN_ENUM_CONVERSION = YES;
				CLANG_WARN_INT_CONVERSION = YES;
				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
				CLANG_WARN_UNREACHABLE_CODE = YES;
				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
				CODE_SIGN_IDENTITY = "-";
				COPY_PHASE_STRIP = NO;
				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
				ENABLE_NS_ASSERTIONS = NO;
				ENABLE_STRICT_OBJC_MSGSEND = YES;
				GCC_C_LANGUAGE_STANDARD = gnu99;
				GCC_NO_COMMON_BLOCKS = YES;
				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
				GCC_WARN_UNDECLARED_SELECTOR = YES;
				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
				GCC_WARN_UNUSED_FUNCTION = YES;
				GCC_WARN_UNUSED_VARIABLE = YES;
				MACOSX_DEPLOYMENT_TARGET = 10.11;
				MTL_ENABLE_DEBUG_INFO = NO;
				SDKROOT = macosx;
			};
			name = Release;
		};
		1D6135231C031B0D00CAE85F /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				PRODUCT_NAME = "$(TARGET_NAME)";
			};
			name = Debug;
		};
		1D6135241C031B0D00CAE85F /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				PRODUCT_NAME = "$(TARGET_NAME)";
			};
			name = Release;
		};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
		1D6135161C031B0D00CAE85F /* Build configuration list for PBXProject "demo" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				1D6135201C031B0D00CAE85F /* Debug */,
				1D6135211C031B0D00CAE85F /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
		1D6135221C031B0D00CAE85F /* Build configuration list for PBXNativeTarget "demo" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				1D6135231C031B0D00CAE85F /* Debug */,
				1D6135241C031B0D00CAE85F /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
/* End XCConfigurationList section */
	};
	rootObject = 1D6135131C031B0D00CAE85F /* Project object */;
}


================================================
FILE: demo/demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
   version = "1.0">
   <FileRef
      location = "self:demo.xcodeproj">
   </FileRef>
</Workspace>
Download .txt
gitextract_tekxsig1/

├── .gitignore
├── LICENSE
├── README.md
├── ZXPUnicode/
│   ├── ZXPUnicode.h
│   └── ZXPUnicode.m
└── demo/
    ├── demo/
    │   └── main.m
    └── demo.xcodeproj/
        ├── project.pbxproj
        └── project.xcworkspace/
            └── contents.xcworkspacedata
Condensed preview — 8 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (17K chars).
[
  {
    "path": ".gitignore",
    "chars": 494,
    "preview": "# Xcode\n#\nbuild/\n*.pbxuser\n!default.pbxuser\n*.mode1v3\n!default.mode1v3\n*.mode2v3\n!default.mode2v3\n*.perspectivev3\n!defau"
  },
  {
    "path": "LICENSE",
    "chars": 1068,
    "preview": "The MIT License (MIT)\n\nCopyright (c) 2015 \n\nPermission is hereby granted, free of charge, to any person obtaining a copy"
  },
  {
    "path": "README.md",
    "chars": 85,
    "preview": "# ZXPUnicode\n在Xcode的控制台里支持array and dictionary 的中文输出,Xcode默认是不支持的.导入分类即可在控制台自动支持中文输出\n"
  },
  {
    "path": "ZXPUnicode/ZXPUnicode.h",
    "chars": 253,
    "preview": "//\n//  ZXPUnicode.h\n//\n//  blog : http://blog.csdn.net/biggercoffee\n//  github : https://github.com/biggercoffee/ZXPUnic"
  },
  {
    "path": "ZXPUnicode/ZXPUnicode.m",
    "chars": 4300,
    "preview": "//\n//  ZXPUnicode.m\n//\n//  blog : http://blog.csdn.net/biggercoffee\n//  github : https://github.com/biggercoffee/ZXPUnic"
  },
  {
    "path": "demo/demo/main.m",
    "chars": 722,
    "preview": "//\n//  main.m\n//  demo\n//\n//  blog : http://blog.csdn.net/biggercoffee\n//  github : https://github.com/biggercoffee/ZXPU"
  },
  {
    "path": "demo/demo.xcodeproj/project.pbxproj",
    "chars": 8319,
    "preview": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section *"
  },
  {
    "path": "demo/demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
    "chars": 149,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:demo.xcodeproj\""
  }
]

About this extraction

This page contains the full source code of the biggercoffee/ZXPUnicode GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 8 files (15.0 KB), approximately 4.8k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!