Commit 6afece09 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: fixed correct display of UTF8 strings within the Extension dialogs (fixes #5848)

parent 7ac6ae55
...@@ -154,7 +154,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget, ...@@ -154,7 +154,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
assert([control isKindOfClass:[NSTextView class]]); assert([control isKindOfClass:[NSTextView class]]);
NSTextView *textView = (NSTextView *)control; NSTextView *textView = (NSTextView *)control;
NSString *string = [NSString stringWithUTF8String:widget->psz_text]; NSString *string = [NSString stringWithUTF8String:widget->psz_text];
NSAttributedString *attrString = [[NSAttributedString alloc] initWithHTML:[string dataUsingEncoding:NSUTF8StringEncoding] documentAttributes:NULL]; NSAttributedString *attrString = [[NSAttributedString alloc] initWithHTML:[string dataUsingEncoding: NSISOLatin1StringEncoding] documentAttributes:NULL];
[[textView textStorage] setAttributedString:attrString]; [[textView textStorage] setAttributedString:attrString];
[textView setNeedsDisplay:YES]; [textView setNeedsDisplay:YES];
[textView scrollRangeToVisible:NSMakeRange(0, 0)]; [textView scrollRangeToVisible:NSMakeRange(0, 0)];
...@@ -170,8 +170,8 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget, ...@@ -170,8 +170,8 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
break; break;
assert([control isKindOfClass:[NSControl class]]); assert([control isKindOfClass:[NSControl class]]);
NSControl *field = (NSControl *)control; NSControl *field = (NSControl *)control;
NSString *string = [NSString stringWithUTF8String:widget->psz_text]; NSString *string = [NSString stringWithCString:widget->psz_text encoding:NSUTF8StringEncoding];
NSAttributedString *attrString = [[NSAttributedString alloc] initWithHTML:[string dataUsingEncoding:NSUTF8StringEncoding] documentAttributes:NULL]; NSAttributedString *attrString = [[NSAttributedString alloc] initWithHTML:[string dataUsingEncoding: NSISOLatin1StringEncoding] documentAttributes:NULL];
[field setAttributedStringValue:attrString]; [field setAttributedStringValue:attrString];
[attrString release]; [attrString release];
break; break;
...@@ -552,7 +552,7 @@ static ExtensionsDialogProvider *_o_sharedInstance = nil; ...@@ -552,7 +552,7 @@ static ExtensionsDialogProvider *_o_sharedInstance = nil;
p_dialog->psz_title ) != 0 ) p_dialog->psz_title ) != 0 )
{ {
NSString *titleString = [NSString stringWithCString:p_dialog->psz_title NSString *titleString = [NSString stringWithCString:p_dialog->psz_title
encoding:NSASCIIStringEncoding]; encoding:NSUTF8StringEncoding];
[dialogWindow setTitle:titleString]; [dialogWindow setTitle:titleString];
} }
......
...@@ -93,7 +93,7 @@ static ExtensionsManager* instance = nil; ...@@ -93,7 +93,7 @@ static ExtensionsManager* instance = nil;
bool b_Active = extension_IsActivated( p_extensions_manager, p_ext ); bool b_Active = extension_IsActivated( p_extensions_manager, p_ext );
NSString *titleString = [NSString stringWithCString:p_ext->psz_title NSString *titleString = [NSString stringWithCString:p_ext->psz_title
encoding:NSASCIIStringEncoding]; encoding:NSUTF8StringEncoding];
if( b_Active && extension_HasMenu( p_extensions_manager, p_ext ) ) if( b_Active && extension_HasMenu( p_extensions_manager, p_ext ) )
{ {
...@@ -116,7 +116,7 @@ static ExtensionsManager* instance = nil; ...@@ -116,7 +116,7 @@ static ExtensionsManager* instance = nil;
{ {
++i_num; ++i_num;
titleString = [NSString stringWithCString:ppsz_titles[i] titleString = [NSString stringWithCString:ppsz_titles[i]
encoding:NSASCIIStringEncoding]; encoding:NSUTF8StringEncoding];
NSMenuItem *menuItem = [submenu addItemWithTitle:titleString NSMenuItem *menuItem = [submenu addItemWithTitle:titleString
action:@selector(triggerMenu:) action:@selector(triggerMenu:)
keyEquivalent:@""]; keyEquivalent:@""];
......
...@@ -675,7 +675,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget, ...@@ -675,7 +675,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
// assert([control isKindOfClass:[NSTextView class]]); // assert([control isKindOfClass:[NSTextView class]]);
// NSTextView *textView = (NSTextView *)control; // NSTextView *textView = (NSTextView *)control;
// NSString *string = [NSString stringWithUTF8String:widget->psz_text]; // NSString *string = [NSString stringWithUTF8String:widget->psz_text];
// NSAttributedString *attrString = [[NSAttributedString alloc] initWithHTML:[string dataUsingEncoding:NSUTF8StringEncoding] documentAttributes:NULL]; // NSAttributedString *attrString = [[NSAttributedString alloc] initWithHTML:[string dataUsingEncoding:NSISOLatin1StringEncoding] documentAttributes:NULL];
// [[textView textStorage] setAttributedString:[[NSAttributedString alloc] initWithString:@"Hello"]]; // [[textView textStorage] setAttributedString:[[NSAttributedString alloc] initWithString:@"Hello"]];
// NSLog(@"%@", string); // NSLog(@"%@", string);
// [textView setNeedsDisplay:YES]; // [textView setNeedsDisplay:YES];
...@@ -688,7 +688,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget, ...@@ -688,7 +688,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
assert([control isKindOfClass:[NSTextView class]]); assert([control isKindOfClass:[NSTextView class]]);
NSTextView *textView = (NSTextView *)control; NSTextView *textView = (NSTextView *)control;
NSString *string = [NSString stringWithUTF8String:widget->psz_text]; NSString *string = [NSString stringWithUTF8String:widget->psz_text];
NSAttributedString *attrString = [[NSAttributedString alloc] initWithHTML:[string dataUsingEncoding:NSUTF8StringEncoding] documentAttributes:NULL]; NSAttributedString *attrString = [[NSAttributedString alloc] initWithHTML:[string dataUsingEncoding:NSISOLatin1StringEncoding] documentAttributes:NULL];
[[textView textStorage] setAttributedString:attrString]; [[textView textStorage] setAttributedString:attrString];
[textView setNeedsDisplay:YES]; [textView setNeedsDisplay:YES];
[textView scrollRangeToVisible:NSMakeRange(0, 0)]; [textView scrollRangeToVisible:NSMakeRange(0, 0)];
...@@ -705,7 +705,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget, ...@@ -705,7 +705,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
assert([control isKindOfClass:[NSControl class]]); assert([control isKindOfClass:[NSControl class]]);
NSControl *field = (NSControl *)control; NSControl *field = (NSControl *)control;
NSString *string = [NSString stringWithUTF8String:widget->psz_text]; NSString *string = [NSString stringWithUTF8String:widget->psz_text];
NSAttributedString *attrString = [[NSAttributedString alloc] initWithHTML:[string dataUsingEncoding:NSUTF8StringEncoding] documentAttributes:NULL]; NSAttributedString *attrString = [[NSAttributedString alloc] initWithHTML:[string dataUsingEncoding:NSISOLatin1StringEncoding] documentAttributes:NULL];
[field setAttributedStringValue:attrString]; [field setAttributedStringValue:attrString];
[attrString release]; [attrString release];
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment