Skip to content

Commit

Permalink
fix:修复导出内购项目表csv文件中文乱码和分隔可能错误的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
iHTCboy committed Apr 6, 2022
1 parent 6bf4ca6 commit 6d8aa61
Show file tree
Hide file tree
Showing 20 changed files with 26 additions and 14 deletions.
12 changes: 7 additions & 5 deletions AppleParty/AppListView/InAppPurchseView/APInAppPurchseVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ class APInAppPurchseVC: NSViewController {

// 创建格式
var iaps = "productId, 商品名称, 价格等级, 价格(RMB), AppleID, 商品类型, 状态, 送审图片\n"
let separator = "\",\""
iaps += iapList.map { item -> String in
return item.vendorId + ", " + item.referenceName + ", " + item.tierStem + ", " + levelChargeMoney(item.tierStem) + ", " + item.adamId
+ ", " + item.addOnType.CNValue() + ", " + item.iTunesConnectStatus.statusValue.0 + ", " + (item.reviewScreenshot?.url ?? "-")
return "\"" + item.vendorId + separator + item.referenceName + separator + item.tierStem + separator + levelChargeMoney(item.tierStem) + separator + item.adamId
+ separator + item.addOnType.CNValue() + separator + item.iTunesConnectStatus.statusValue.0 + separator + (item.reviewScreenshot?.url ?? "-") + "\""
}.joined(separator: "\n")

// 保存文件
Expand All @@ -74,10 +75,11 @@ class APInAppPurchseVC: NSViewController {
mySave.begin { (result) -> Void in
if result == .OK {
let filePath = mySave.url
// 含有中文,编码不能用 utf8
let gb_18030_2000 = String.Encoding(rawValue: CFStringConvertEncodingToNSStringEncoding(CFStringEncoding(CFStringEncodings.GB_18030_2000.rawValue)))
do {
try iaps.write(to: filePath!, atomically: true, encoding: gb_18030_2000)
// 含有中文,excel在打开CSV文件时默认用ASNI打开,无BOM头的unicode文件会出现乱码
var data = Data([0xEF, 0xBB, 0xBF])
data.append(contentsOf: iaps.data(using: .utf8) ?? Data())
try data.write(to: filePath!)
} catch {
// failed to write file (bad permissions, bad filename etc.)
}
Expand Down
6 changes: 6 additions & 0 deletions AppleParty/SparkleUpdate/AppleParty-release.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
<title>AppleParty 更新说明</title>
</head>
<body>
<div class="release">
<h2>v2.0.1<span class="date">2022-04-06</span></h2>
<ul class="fl">
<li class="f">修复导出内购项目表csv文件中文乱码和分隔可能错误的问题</li>
</ul>
</div>
<div>
<h4>What's AppleParty</h4>
<div class="alert">
Expand Down
6 changes: 3 additions & 3 deletions AppleParty/SparkleUpdate/update.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<description>Most recent changes with links to updates.</description>
<language>zh_CN</language>
<item>
<title>Version 2.0.0</title>
<sparkle:releaseNotesLink>https://raw.githubusercontent.com/37iOS/AppleParty/main/AppleParty/SparkleUpdate/AppleParty-release.html</sparkle:releaseNotesLink>
<pubDate>2022-03-30</pubDate>
<title>Version 2.0.1</title>
<sparkle:releaseNotesLink>https://37ios.github.io/?https://raw.githubusercontent.com/37iOS/AppleParty/main/AppleParty/SparkleUpdate/AppleParty-release.html</sparkle:releaseNotesLink>
<pubDate>2022-04-06</pubDate>
<enclosure
url="AppleParty-2.0.0.zip"
sparkle:shortVersionString="2.0.0"
Expand Down
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,16 @@ pod install
> 项目依赖 Swift Package,Xcode 可能下载失败,可以清理缓存试试: 打开 Xcode File -> Packages -> Reset Package Caches
### 效果示例
<img src="screenshot/01.jpg" width="800" height:auto alt="screenshot/01.jpg"/>
<img src="screenshot/03.jpg" width="800" height:auto alt="screenshot/03.jpg"/>
<img src="screenshot/04.jpg" width="800" height:auto alt="screenshot/04.jpg"/>
<img src="screenshot/06.jpg" width="800" height:auto alt="screenshot/06.jpg"/>
<img src="screenshot/09.jpg" width="800" height:auto alt="screenshot/09.jpg"/>
<img src="screenshot/10.jpg" width="800" height:auto alt="screenshot/10.jpg"/>
<img src="screenshot/01.png" width="800" height:auto alt="screenshot/01.png"/>
<img src="screenshot/02.png" width="800" height:auto alt="screenshot/02.png"/>
<img src="screenshot/03.png" width="800" height:auto alt="screenshot/03.png"/>
<img src="screenshot/04.png" width="800" height:auto alt="screenshot/04.png"/>
<img src="screenshot/05.png" width="800" height:auto alt="screenshot/05.png"/>
<img src="screenshot/06.png" width="800" height:auto alt="screenshot/06.png"/>
<img src="screenshot/07.png" width="800" height:auto alt="screenshot/07.png"/>
<img src="screenshot/08.png" width="800" height:auto alt="screenshot/08.png"/>
<img src="screenshot/09.png" width="800" height:auto alt="screenshot/09.png"/>
<img src="screenshot/10.png" width="800" height:auto alt="screenshot/10.png"/>



Expand Down
Binary file removed screenshot/01.jpg
Binary file not shown.
Binary file added screenshot/01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot/02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed screenshot/03.jpg
Binary file not shown.
Binary file added screenshot/03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed screenshot/04.jpg
Binary file not shown.
Binary file added screenshot/04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot/05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed screenshot/06.jpg
Binary file not shown.
Binary file added screenshot/06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot/07.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot/08.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed screenshot/09.jpg
Binary file not shown.
Binary file added screenshot/09.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed screenshot/10.jpg
Binary file not shown.
Binary file added screenshot/10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6d8aa61

Please sign in to comment.